Removed useless class pixel_data.

This commit is contained in:
Guillaume Melquiond 2010-02-13 10:43:57 +00:00
parent 23af8767a7
commit 9d173ca4ec
2 changed files with 2 additions and 55 deletions

View File

@ -19,9 +19,10 @@
#include "global.hpp"
#include "config.hpp"
#include "video.hpp"
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
@ -1726,27 +1727,6 @@ SDL_Color inverse(const SDL_Color& colour) {
return inverse;
}
void pixel_data::read(const config& cfg) {
const std::string& red = cfg["red"];
const std::string& green = cfg["green"];
const std::string& blue = cfg["blue"];
if (red.empty())
r = 0;
else
r = atoi(red.c_str());
if (green.empty())
g = 0;
else
g = atoi(green.c_str());
if (blue.empty())
b = 0;
else
b = atoi(blue.c_str());
}
surface_restorer::surface_restorer() : target_(NULL), rect_(empty_rect), surface_(NULL)
{
}

View File

@ -305,39 +305,6 @@ bool operator!=(const SDL_Color& a, const SDL_Color& b);
SDL_Color inverse(const SDL_Color& colour);
SDL_Color int_to_color(const Uint32 rgb);
class config; // no need to include config.hpp
struct pixel_data
{
pixel_data() : r(0), g(0), b(0)
{}
pixel_data(int red, int green, int blue) : r(red), g(green), b(blue)
{}
pixel_data(int pixel, SDL_PixelFormat* fmt) : r(0), g(0), b(0) {
unformat(pixel, fmt);
}
pixel_data(config& cfg) : r(0), g(0), b(0) {
read(cfg);
}
int format(SDL_PixelFormat* fmt) const {
return SDL_MapRGB(fmt,r,g,b);
}
void unformat(int pixel, SDL_PixelFormat* fmt) {
r = ((pixel&fmt->Rmask) >> fmt->Rshift);
g = ((pixel&fmt->Gmask) >> fmt->Gshift);
b = ((pixel&fmt->Bmask) >> fmt->Bshift);
}
void read(const config& cfg);
int r, g, b;
};
struct surface_lock
{
surface_lock(const surface &surf) : surface_(surf), locked_(false)