[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r4044 - in trunk/pingus/src: editor engine/display pingus p
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r4044 - in trunk/pingus/src: editor engine/display pingus pingus/worldobjs |
Date: |
Fri, 6 Nov 2009 00:13:20 +0100 |
Author: grumbel
Date: 2009-11-06 00:13:19 +0100 (Fri, 06 Nov 2009)
New Revision: 4044
Added:
trunk/pingus/src/engine/display/blitter.cpp
trunk/pingus/src/engine/display/blitter.hpp
trunk/pingus/src/engine/display/blitter_impl.hpp
Removed:
trunk/pingus/src/pingus/blitter.cpp
trunk/pingus/src/pingus/blitter.hpp
trunk/pingus/src/pingus/blitter_impl.hpp
Modified:
trunk/pingus/src/editor/level_objs.cpp
trunk/pingus/src/engine/display/sprite.cpp
trunk/pingus/src/engine/display/surface.cpp
trunk/pingus/src/pingus/credits.cpp
trunk/pingus/src/pingus/ground_map.cpp
trunk/pingus/src/pingus/resource.cpp
trunk/pingus/src/pingus/result_screen.cpp
trunk/pingus/src/pingus/start_screen.cpp
trunk/pingus/src/pingus/worldobjs/surface_background.cpp
Log:
Moved blitter*.?pp to engine/display/
Modified: trunk/pingus/src/editor/level_objs.cpp
===================================================================
--- trunk/pingus/src/editor/level_objs.cpp 2009-11-05 23:10:49 UTC (rev
4043)
+++ trunk/pingus/src/editor/level_objs.cpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -20,7 +20,7 @@
#include <string>
#include <iostream>
#include "editor/level_impl.hpp"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
#include "pingus/resource.hpp"
#include "pingus/res_descriptor.hpp"
#include "engine/display/display.hpp"
Copied: trunk/pingus/src/engine/display/blitter.cpp (from rev 4037,
trunk/pingus/src/pingus/blitter.cpp)
===================================================================
--- trunk/pingus/src/pingus/blitter.cpp 2009-11-05 19:22:47 UTC (rev 4037)
+++ trunk/pingus/src/engine/display/blitter.cpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -0,0 +1,252 @@
+// Pingus - A free Lemmings clone
+// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#include "engine/display/blitter.hpp"
+
+#include <config.h>
+#include <stdio.h>
+#include <assert.h>
+#include "SDL.h"
+
+#include "util/string_util.hpp"
+#include "pingus/pingus_error.hpp"
+#include "pingus/globals.hpp"
+#include "math/math.hpp"
+#include "pingus/debug.hpp"
+#include "engine/display/blitter_impl.hpp"
+
+SDL_Surface*
+Blitter::scale_surface(SDL_Surface* surface, int width, int height)
+{
+ int i;
+ int j;
+ unsigned char *pixels;
+ unsigned char *new_pixels;
+ int x;
+ int bpp;
+ int new_pitch;
+ SDL_Surface* new_surface;
+
+ bpp = surface->format->BytesPerPixel;
+ if (bpp == 1) {
+ SDL_Color pal[256];
+ Uint32 ckey;
+ int useckey;
+
+ useckey = surface->flags & SDL_SRCCOLORKEY;
+ new_surface = SDL_CreateRGBSurface(SDL_SWSURFACE | (useckey ?
SDL_SRCCOLORKEY : 0), width, height, 8, 0, 0, 0, 0);
+
+ SDL_LockSurface(surface);
+ SDL_LockSurface(new_surface);
+
+ pixels = static_cast<unsigned char*>(surface->pixels);
+ new_pixels = static_cast<unsigned char*>(new_surface->pixels);
+ new_pitch = new_surface->pitch;
+
+ memcpy(pal, surface->format->palette->colors, sizeof(SDL_Color) * 256);
+ ckey = surface->format->colorkey;
+
+ for (i = 0; i < height; ++i) {
+ x = i * new_pitch;
+ for (j = 0; j < width; ++j) {
+ new_pixels[x] = pixels[(i * surface->h / height) * surface->pitch + j
* surface->w / width];
+ ++x;
+ }
+ }
+
+ SDL_UnlockSurface(surface);
+ SDL_UnlockSurface(new_surface);
+
+ SDL_SetPalette(new_surface, SDL_LOGPAL | SDL_PHYSPAL, pal, 0, 256);
+ if (useckey) {
+ SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, ckey);
+ }
+ } else {
+ int ix, iy;
+ float fx, fy, fz;
+ unsigned char *p1, *p2, *p3, *p4;
+
+ new_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height,
surface->format->BitsPerPixel,
+ surface->format->Rmask,
surface->format->Gmask, surface->format->Bmask, surface->format->Amask);
+
+ SDL_LockSurface(surface);
+ SDL_LockSurface(new_surface);
+
+ pixels = static_cast<unsigned char*>(surface->pixels);
+ new_pixels = static_cast<unsigned char*>(new_surface->pixels);
+ new_pitch = new_surface->pitch;
+
+ for (i = 0; i < height; ++i) {
+ x = i * new_pitch;
+ fy = static_cast<float>(i) * static_cast<float>(surface->h) /
static_cast<float>(height);
+ iy = (int)fy;
+ fy -= static_cast<float>(iy);
+ for (j = 0; j < width; ++j) {
+ fx = static_cast<float>(j) * static_cast<float>(surface->w) /
static_cast<float>(width);
+ ix = (int)fx;
+ fx -= static_cast<float>(ix);
+ fz = (fx + fy) / 2;
+
+ p1 = &pixels[iy * surface->pitch + ix * bpp];
+ p2 = (iy != surface->h - 1) ?
+ &pixels[(iy + 1) * surface->pitch + ix * bpp] : p1;
+ p3 = (ix != surface->w - 1) ?
+ &pixels[iy * surface->pitch + (ix + 1) * bpp] : p1;
+ p4 = (iy != surface->h - 1 && ix != surface->w - 1) ?
+ &pixels[(iy + 1) * surface->pitch + (ix + 1) * bpp] : p1;
+
+ new_pixels[x + 0] = static_cast<unsigned char>(
+ (static_cast<float>(p1[0]) * (1 - fy) + static_cast<float>(p2[0]) *
fy +
+ static_cast<float>(p1[0]) * (1 - fx) + static_cast<float>(p3[0]) *
fx +
+ static_cast<float>(p1[0]) * (1 - fz) + static_cast<float>(p4[0]) *
fz) / 3.0 + .5);
+ new_pixels[x + 1] = static_cast<unsigned char>(
+ (static_cast<float>(p1[1]) * (1 - fy) + static_cast<float>(p2[1]) *
fy +
+ static_cast<float>(p1[1]) * (1 - fx) + static_cast<float>(p3[1]) *
fx +
+ static_cast<float>(p1[1]) * (1 - fz) + static_cast<float>(p4[1]) *
fz) / 3.0 + .5);
+ new_pixels[x + 2] = static_cast<unsigned char>(
+ (static_cast<float>(p1[2]) * (1 - fy) + static_cast<float>(p2[2]) *
fy +
+ static_cast<float>(p1[2]) * (1 - fx) + static_cast<float>(p3[2]) *
fx +
+ static_cast<float>(p1[2]) * (1 - fz) + static_cast<float>(p4[2]) *
fz) / 3.0 + .5);
+ if (bpp == 4) {
+ new_pixels[x + 3] = static_cast<unsigned char>(
+ (static_cast<float>(p1[3]) * (1 - fy) + static_cast<float>(p2[3])
* fy +
+ static_cast<float>(p1[3]) * (1 - fx) + static_cast<float>(p3[3])
* fx +
+ static_cast<float>(p1[3]) * (1 - fz) + static_cast<float>(p4[3])
* fz) / 3.0 + .5);
+ }
+ x += bpp;
+ }
+ }
+
+ SDL_UnlockSurface(surface);
+ SDL_UnlockSurface(new_surface);
+ }
+
+ return new_surface;
+}
+
+/** Flip a surface horizontal */
+Surface
+Blitter::flip_horizontal (Surface prov)
+{
+ return BlitterImpl::modify(prov, BlitterImpl::transform_flip());
+}
+
+/** Flip a surface vertical */
+Surface
+Blitter::flip_vertical (Surface sur)
+{
+ return BlitterImpl::modify(sur, BlitterImpl::transform_rot180_flip());
+}
+
+/** Rotate a surface 90 degrees */
+Surface
+Blitter::rotate_90 (Surface sur)
+{
+ return BlitterImpl::modify(sur, BlitterImpl::transform_rot90());
+}
+
+
+Surface
+Blitter::rotate_180 (Surface sur)
+{
+ return BlitterImpl::modify(sur, BlitterImpl::transform_rot180());
+}
+
+Surface
+Blitter::rotate_270 (Surface sur)
+{
+ return BlitterImpl::modify(sur, BlitterImpl::transform_rot270());
+}
+
+Surface
+Blitter::rotate_90_flip (Surface sur)
+{
+ return BlitterImpl::modify(sur, BlitterImpl::transform_rot90_flip());
+}
+
+Surface
+Blitter::rotate_180_flip (Surface sur)
+{
+ return BlitterImpl::modify(sur, BlitterImpl::transform_rot180_flip());
+}
+
+Surface
+Blitter::rotate_270_flip (Surface sur)
+{
+ return BlitterImpl::modify(sur, BlitterImpl::transform_rot270_flip());
+}
+
+SDL_Surface*
+Blitter::create_surface_rgba(int w, int h)
+{
+ return SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, w, h, 32,
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
+#else
+ 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
+#endif
+ );
+}
+
+SDL_Surface*
+Blitter::create_surface_rgb(int w, int h)
+{
+ return SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 24,
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ 0xff0000, 0x00ff00, 0x0000ff, 0x000000
+#else
+ 0x0000ff, 0x00ff00, 0xff0000, 0x000000
+#endif
+ );
+}
+
+SDL_Surface*
+Blitter::create_surface_from_format(SDL_Surface* surface, int w, int h)
+{
+ Uint32 flags = 0;
+ if (surface->flags & SDL_SWSURFACE)
+ flags |= SDL_SWSURFACE;
+
+ if (surface->flags & SDL_HWSURFACE)
+ flags |= SDL_HWSURFACE;
+
+ if (surface->flags & SDL_SRCCOLORKEY)
+ flags |= SDL_SRCCOLORKEY;
+
+ if (surface->flags & SDL_SRCALPHA)
+ flags |= SDL_SRCALPHA;
+
+ SDL_Surface* new_surface = SDL_CreateRGBSurface(flags, w, h,
+
surface->format->BitsPerPixel,
+ surface->format->Rmask,
+ surface->format->Gmask,
+ surface->format->Bmask,
+ surface->format->Amask);
+
+ if (surface->flags & SDL_SRCALPHA)
+ SDL_SetAlpha(new_surface, SDL_SRCALPHA, surface->format->alpha);
+
+ if (surface->format->palette)
+ SDL_SetPalette(new_surface, SDL_LOGPAL, surface->format->palette->colors,
+ 0, surface->format->palette->ncolors);
+
+ if (surface->flags & SDL_SRCCOLORKEY)
+ SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY, surface->format->colorkey);
+
+ return new_surface;
+}
+
+/* EOF */
Copied: trunk/pingus/src/engine/display/blitter.hpp (from rev 4037,
trunk/pingus/src/pingus/blitter.hpp)
Copied: trunk/pingus/src/engine/display/blitter_impl.hpp (from rev 4043,
trunk/pingus/src/pingus/blitter_impl.hpp)
Modified: trunk/pingus/src/engine/display/sprite.cpp
===================================================================
--- trunk/pingus/src/engine/display/sprite.cpp 2009-11-05 23:10:49 UTC (rev
4043)
+++ trunk/pingus/src/engine/display/sprite.cpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -24,7 +24,7 @@
#include "math/origin.hpp"
#include "math/vector2i.hpp"
#include "SDL_image.h"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
#include "engine/display/surface.hpp"
#include "util/pathname.hpp"
#include "pingus/resource.hpp"
Modified: trunk/pingus/src/engine/display/surface.cpp
===================================================================
--- trunk/pingus/src/engine/display/surface.cpp 2009-11-05 23:10:49 UTC (rev
4043)
+++ trunk/pingus/src/engine/display/surface.cpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -23,7 +23,7 @@
#include "math/rect.hpp"
#include "pingus/debug.hpp"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
class SurfaceImpl
{
Deleted: trunk/pingus/src/pingus/blitter.cpp
===================================================================
--- trunk/pingus/src/pingus/blitter.cpp 2009-11-05 23:10:49 UTC (rev 4043)
+++ trunk/pingus/src/pingus/blitter.cpp 2009-11-05 23:13:19 UTC (rev 4044)
@@ -1,255 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-#include "pingus/blitter.hpp"
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include "SDL.h"
-#include "util/string_util.hpp"
-#include "pingus/pingus_error.hpp"
-#include "pingus/globals.hpp"
-#include "math/math.hpp"
-#include "pingus/debug.hpp"
-#include "pingus/blitter_impl.hpp"
-
-/* Headers needed for i18n / gettext */
-#include "gettext.h"
-
-SDL_Surface*
-Blitter::scale_surface(SDL_Surface* surface, int width, int height)
-{
- int i;
- int j;
- unsigned char *pixels;
- unsigned char *new_pixels;
- int x;
- int bpp;
- int new_pitch;
- SDL_Surface* new_surface;
-
- bpp = surface->format->BytesPerPixel;
- if (bpp == 1) {
- SDL_Color pal[256];
- Uint32 ckey;
- int useckey;
-
- useckey = surface->flags & SDL_SRCCOLORKEY;
- new_surface = SDL_CreateRGBSurface(SDL_SWSURFACE | (useckey ?
SDL_SRCCOLORKEY : 0), width, height, 8, 0, 0, 0, 0);
-
- SDL_LockSurface(surface);
- SDL_LockSurface(new_surface);
-
- pixels = static_cast<unsigned char*>(surface->pixels);
- new_pixels = static_cast<unsigned char*>(new_surface->pixels);
- new_pitch = new_surface->pitch;
-
- memcpy(pal, surface->format->palette->colors, sizeof(SDL_Color) * 256);
- ckey = surface->format->colorkey;
-
- for (i = 0; i < height; ++i) {
- x = i * new_pitch;
- for (j = 0; j < width; ++j) {
- new_pixels[x] = pixels[(i * surface->h / height) * surface->pitch + j
* surface->w / width];
- ++x;
- }
- }
-
- SDL_UnlockSurface(surface);
- SDL_UnlockSurface(new_surface);
-
- SDL_SetPalette(new_surface, SDL_LOGPAL | SDL_PHYSPAL, pal, 0, 256);
- if (useckey) {
- SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, ckey);
- }
- } else {
- int ix, iy;
- float fx, fy, fz;
- unsigned char *p1, *p2, *p3, *p4;
-
- new_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height,
surface->format->BitsPerPixel,
- surface->format->Rmask,
surface->format->Gmask, surface->format->Bmask, surface->format->Amask);
-
- SDL_LockSurface(surface);
- SDL_LockSurface(new_surface);
-
- pixels = static_cast<unsigned char*>(surface->pixels);
- new_pixels = static_cast<unsigned char*>(new_surface->pixels);
- new_pitch = new_surface->pitch;
-
- for (i = 0; i < height; ++i) {
- x = i * new_pitch;
- fy = static_cast<float>(i) * static_cast<float>(surface->h) /
static_cast<float>(height);
- iy = (int)fy;
- fy -= static_cast<float>(iy);
- for (j = 0; j < width; ++j) {
- fx = static_cast<float>(j) * static_cast<float>(surface->w) /
static_cast<float>(width);
- ix = (int)fx;
- fx -= static_cast<float>(ix);
- fz = (fx + fy) / 2;
-
- p1 = &pixels[iy * surface->pitch + ix * bpp];
- p2 = (iy != surface->h - 1) ?
- &pixels[(iy + 1) * surface->pitch + ix * bpp] : p1;
- p3 = (ix != surface->w - 1) ?
- &pixels[iy * surface->pitch + (ix + 1) * bpp] : p1;
- p4 = (iy != surface->h - 1 && ix != surface->w - 1) ?
- &pixels[(iy + 1) * surface->pitch + (ix + 1) * bpp] : p1;
-
- new_pixels[x + 0] = static_cast<unsigned char>(
- (static_cast<float>(p1[0]) * (1 - fy) + static_cast<float>(p2[0]) *
fy +
- static_cast<float>(p1[0]) * (1 - fx) + static_cast<float>(p3[0]) *
fx +
- static_cast<float>(p1[0]) * (1 - fz) + static_cast<float>(p4[0]) *
fz) / 3.0 + .5);
- new_pixels[x + 1] = static_cast<unsigned char>(
- (static_cast<float>(p1[1]) * (1 - fy) + static_cast<float>(p2[1]) *
fy +
- static_cast<float>(p1[1]) * (1 - fx) + static_cast<float>(p3[1]) *
fx +
- static_cast<float>(p1[1]) * (1 - fz) + static_cast<float>(p4[1]) *
fz) / 3.0 + .5);
- new_pixels[x + 2] = static_cast<unsigned char>(
- (static_cast<float>(p1[2]) * (1 - fy) + static_cast<float>(p2[2]) *
fy +
- static_cast<float>(p1[2]) * (1 - fx) + static_cast<float>(p3[2]) *
fx +
- static_cast<float>(p1[2]) * (1 - fz) + static_cast<float>(p4[2]) *
fz) / 3.0 + .5);
- if (bpp == 4) {
- new_pixels[x + 3] = static_cast<unsigned char>(
- (static_cast<float>(p1[3]) * (1 - fy) + static_cast<float>(p2[3])
* fy +
- static_cast<float>(p1[3]) * (1 - fx) + static_cast<float>(p3[3])
* fx +
- static_cast<float>(p1[3]) * (1 - fz) + static_cast<float>(p4[3])
* fz) / 3.0 + .5);
- }
- x += bpp;
- }
- }
-
- SDL_UnlockSurface(surface);
- SDL_UnlockSurface(new_surface);
- }
-
- return new_surface;
-}
-
-/** Flip a surface horizontal */
-Surface
-Blitter::flip_horizontal (Surface prov)
-{
- return BlitterImpl::modify(prov, BlitterImpl::transform_flip());
-}
-
-/** Flip a surface vertical */
-Surface
-Blitter::flip_vertical (Surface sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot180_flip());
-}
-
-/** Rotate a surface 90 degrees */
-Surface
-Blitter::rotate_90 (Surface sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot90());
-}
-
-
-Surface
-Blitter::rotate_180 (Surface sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot180());
-}
-
-Surface
-Blitter::rotate_270 (Surface sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot270());
-}
-
-Surface
-Blitter::rotate_90_flip (Surface sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot90_flip());
-}
-
-Surface
-Blitter::rotate_180_flip (Surface sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot180_flip());
-}
-
-Surface
-Blitter::rotate_270_flip (Surface sur)
-{
- return BlitterImpl::modify(sur, BlitterImpl::transform_rot270_flip());
-}
-
-SDL_Surface*
-Blitter::create_surface_rgba(int w, int h)
-{
- return SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, w, h, 32,
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
-#else
- 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
-#endif
- );
-}
-
-SDL_Surface*
-Blitter::create_surface_rgb(int w, int h)
-{
- return SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 24,
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- 0xff0000, 0x00ff00, 0x0000ff, 0x000000
-#else
- 0x0000ff, 0x00ff00, 0xff0000, 0x000000
-#endif
- );
-}
-
-SDL_Surface*
-Blitter::create_surface_from_format(SDL_Surface* surface, int w, int h)
-{
- Uint32 flags = 0;
- if (surface->flags & SDL_SWSURFACE)
- flags |= SDL_SWSURFACE;
-
- if (surface->flags & SDL_HWSURFACE)
- flags |= SDL_HWSURFACE;
-
- if (surface->flags & SDL_SRCCOLORKEY)
- flags |= SDL_SRCCOLORKEY;
-
- if (surface->flags & SDL_SRCALPHA)
- flags |= SDL_SRCALPHA;
-
- SDL_Surface* new_surface = SDL_CreateRGBSurface(flags, w, h,
-
surface->format->BitsPerPixel,
- surface->format->Rmask,
- surface->format->Gmask,
- surface->format->Bmask,
- surface->format->Amask);
-
- if (surface->flags & SDL_SRCALPHA)
- SDL_SetAlpha(new_surface, SDL_SRCALPHA, surface->format->alpha);
-
- if (surface->format->palette)
- SDL_SetPalette(new_surface, SDL_LOGPAL, surface->format->palette->colors,
- 0, surface->format->palette->ncolors);
-
- if (surface->flags & SDL_SRCCOLORKEY)
- SDL_SetColorKey(new_surface, SDL_SRCCOLORKEY, surface->format->colorkey);
-
- return new_surface;
-}
-
-/* EOF */
Deleted: trunk/pingus/src/pingus/blitter.hpp
===================================================================
--- trunk/pingus/src/pingus/blitter.hpp 2009-11-05 23:10:49 UTC (rev 4043)
+++ trunk/pingus/src/pingus/blitter.hpp 2009-11-05 23:13:19 UTC (rev 4044)
@@ -1,72 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_PINGUS_BLITTER_HPP
-#define HEADER_PINGUS_PINGUS_BLITTER_HPP
-
-#include "SDL.h"
-#include "pingus/pingus.hpp"
-#include "math/color.hpp"
-#include "math/rect.hpp"
-
-class Surface;
-
-/** A bunch of blitting and creation functions to operate on Surface. */
-class Blitter
-{
-public:
- static SDL_Surface* create_surface_rgba(int w, int h);
- static SDL_Surface* create_surface_rgb(int w, int h);
- static SDL_Surface* create_surface_from_format(SDL_Surface* surface, int w,
int h);
-
- /** Flip a surface horizontal */
- static Surface flip_horizontal (Surface sur);
-
- /** Flip a surface vertical */
- static Surface flip_vertical (Surface sur);
-
- /** Rotate a surface 90 degrees */
- static Surface rotate_90 (Surface sur);
-
- static Surface rotate_180 (Surface sur);
-
- static Surface rotate_270 (Surface sur);
-
- static Surface rotate_90_flip (Surface sur);
-
- static Surface rotate_180_flip (Surface sur);
-
- static Surface rotate_270_flip (Surface sur);
-
- /** Creates a new surface with the given width and height and
- stretches the source surface onto it, the caller is responsible
- to delete the returned Surface.
-
- @param surface The source surface
- @param width The new width of the surface.
- @param height The new height of the surface.
- @return A newly created surface, the caller is responsible to delete it.
*/
- static SDL_Surface* scale_surface(SDL_Surface* surface, int width, int
height);
-
-private:
- Blitter (const Blitter&);
- Blitter& operator= (const Blitter&);
-};
-
-#endif
-
-/* EOF */
-
Deleted: trunk/pingus/src/pingus/blitter_impl.hpp
===================================================================
--- trunk/pingus/src/pingus/blitter_impl.hpp 2009-11-05 23:10:49 UTC (rev
4043)
+++ trunk/pingus/src/pingus/blitter_impl.hpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -1,216 +0,0 @@
-// Pingus - A free Lemmings clone
-// Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_PINGUS_PINGUS_BLITTER_IMPL_HPP
-#define HEADER_PINGUS_PINGUS_BLITTER_IMPL_HPP
-
-#include <iostream>
-#include "engine/display/surface.hpp"
-#include "pingus/pingus.hpp"
-
-/** A collection of helper functions for the blitter class */
-namespace BlitterImpl {
-
-/** Rotate a surface 90 degree */
-struct transform_rot90
-{
- static inline int get_index(int width, int height, int spitch, int tpitch,
int x, int y) {
- return (x * tpitch) + (height - y - 1);
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- return (height - y - 1);
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- return x;
- }
-
- static inline int get_width(int width, int height) { return height; }
- static inline int get_height(int width, int height) { return width; }
-};
-
-/** Rotate a surface 180 degree */
-struct transform_rot180
-{
- static inline int get_index(int width, int height, int spitch, int tpitch,
int x, int y) {
- return (spitch * height) - (y * spitch + x) - 1;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
UNUSED_ARG(height); UNUSED_ARG(y);
- return width - x - 1;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
UNUSED_ARG(width); UNUSED_ARG(x);
- return height - y - 1;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(height);
return width; }
- static inline int get_height(int width, int height) { UNUSED_ARG(width);
return height; }
-};
-
-/** Rotate a surface 270 degree */
-struct transform_rot270
-{
- static inline int get_index(int width, int height, int spitch, int tpitch,
int x, int y) {
- return ((width - x - 1) * tpitch) + y;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(x);
- return y;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(height);
- UNUSED_ARG(y);
-
- return width - x - 1;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(width);
return height; }
- static inline int get_height(int width, int height) { UNUSED_ARG(height);
return width; }
-};
-
-/** flip a surface */
-struct transform_flip
-{
- static inline int get_index(int width, int height, int spitch, int tpitch,
int x, int y) {
- UNUSED_ARG(height);
- return (y * spitch) + (width - x - 1);
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(height); UNUSED_ARG(y);
- return width - x - 1;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(x);
- return y;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(height);
return width; }
- static inline int get_height(int width, int height) { UNUSED_ARG(width);
return height; }
-};
-
-/** Rotate a surface 90 degree and then flip it */
-struct transform_rot90_flip
-{
- static inline int get_index(int width, int height, int spitch, int tpitch,
int x, int y) {
- UNUSED_ARG(width);
- return (x * tpitch) + y;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(x);
- return y;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(y);
- return x;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(width);
return height; }
- static inline int get_height(int width, int height) { UNUSED_ARG(height);
return width; }
-};
-
-/** Rotate a surface 180 degree and then flip it */
-struct transform_rot180_flip
-{
- static inline int get_index(int width, int height, int spitch, int tpitch,
int x, int y) {
- return ((height - y - 1) * spitch) + x;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(height); UNUSED_ARG(y);
- return x;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(x);
- return height - y - 1;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(height);
return width; }
- static inline int get_height(int width, int height) { UNUSED_ARG(width);
return height; }
-};
-
-/** Rotate a surface 270 degree and then flip it */
-struct transform_rot270_flip
-{
- static inline int get_index(int width, int height, int spitch, int tpitch,
int x, int y) {
- return ((width - x - 1) * tpitch) + height - y - 1;
- }
-
- static inline int get_x(int width, int height, int x, int y) {
- UNUSED_ARG(width); UNUSED_ARG(x);
- return height - y - 1;
- }
-
- static inline int get_y(int width, int height, int x, int y) {
- UNUSED_ARG(height); UNUSED_ARG(y);
- return width - x - 1;
- }
-
- static inline int get_width (int width, int height) { UNUSED_ARG(width);
return height; }
- static inline int get_height(int width, int height) { UNUSED_ARG(height);
return width; }
-};
-
-template<class TransF>
-inline
-Surface modify(Surface source_buffer, const TransF&)
-{
- SDL_Surface* source = source_buffer.get_surface();
- SDL_LockSurface(source);
-
- if (source->format->palette)
- {
- Surface target_buffer(TransF::get_width (source_buffer.get_width(),
source_buffer.get_height()),
- TransF::get_height(source_buffer.get_width(),
source_buffer.get_height()),
- source->format->palette,
- (source->flags & SDL_SRCCOLORKEY) ?
source->format->colorkey : -1);
- SDL_Surface* target = target_buffer.get_surface();
- SDL_LockSurface(target);
-
- uint8_t* source_buf = static_cast<uint8_t*>(source->pixels);
- uint8_t* target_buf = static_cast<uint8_t*>(target->pixels);
-
- for (int y = 0; y < source->h; ++y)
- for (int x = 0; x < source->w; ++x)
- {
- target_buf[TransF::get_index(source->w, source->h, source->pitch,
target->pitch, x, y)] = source_buf[y * source->pitch + x];
- }
-
- SDL_UnlockSurface(source);
- SDL_UnlockSurface(target);
- return target_buffer;
- }
- else
- {
- std::cout << "Error: Blitter::modify: Unsupported PixelFormat:
BytesPerPixel: "
- << int(source->format->BytesPerPixel) << std::endl;
- SDL_UnlockSurface(source);
- return source_buffer.clone();
- }
-}
-
-} // namespace BlitterImpl
-
-#endif
-
-/* EOF */
Modified: trunk/pingus/src/pingus/credits.cpp
===================================================================
--- trunk/pingus/src/pingus/credits.cpp 2009-11-05 23:10:49 UTC (rev 4043)
+++ trunk/pingus/src/pingus/credits.cpp 2009-11-05 23:13:19 UTC (rev 4044)
@@ -27,7 +27,7 @@
#include "pingus/fonts.hpp"
#include "gettext.h"
#include "engine/display/display.hpp"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
class CreditsOkButton
: public GUI::SurfaceButton
Modified: trunk/pingus/src/pingus/ground_map.cpp
===================================================================
--- trunk/pingus/src/pingus/ground_map.cpp 2009-11-05 23:10:49 UTC (rev
4043)
+++ trunk/pingus/src/pingus/ground_map.cpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -20,7 +20,7 @@
#include <iostream>
#include "engine/display/scene_context.hpp"
#include "pingus/pingus_error.hpp"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
#include "pingus/pingus_level.hpp"
#include "gettext.h"
#include "pingus/collision_map.hpp"
Modified: trunk/pingus/src/pingus/resource.cpp
===================================================================
--- trunk/pingus/src/pingus/resource.cpp 2009-11-05 23:10:49 UTC (rev
4043)
+++ trunk/pingus/src/pingus/resource.cpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -23,7 +23,7 @@
#include "pingus/globals.hpp"
#include "pingus/font_description.hpp"
#include "pingus/res_descriptor.hpp"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
#include "engine/display/sprite_description.hpp"
#include "pingus/debug.hpp"
Modified: trunk/pingus/src/pingus/result_screen.cpp
===================================================================
--- trunk/pingus/src/pingus/result_screen.cpp 2009-11-05 23:10:49 UTC (rev
4043)
+++ trunk/pingus/src/pingus/result_screen.cpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -22,7 +22,7 @@
#include "engine/gui/surface_button.hpp"
#include "engine/gui/gui_manager.hpp"
#include "engine/screen/screen_manager.hpp"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
#include "pingus/res_descriptor.hpp"
#include "pingus/resource.hpp"
#include "pingus/fonts.hpp"
Modified: trunk/pingus/src/pingus/start_screen.cpp
===================================================================
--- trunk/pingus/src/pingus/start_screen.cpp 2009-11-05 23:10:49 UTC (rev
4043)
+++ trunk/pingus/src/pingus/start_screen.cpp 2009-11-05 23:13:19 UTC (rev
4044)
@@ -21,7 +21,7 @@
#include "engine/gui/surface_button.hpp"
#include "engine/gui/component.hpp"
#include "engine/screen/screen_manager.hpp"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
#include "gettext.h"
#include "pingus/game_session.hpp"
#include "pingus/globals.hpp"
Modified: trunk/pingus/src/pingus/worldobjs/surface_background.cpp
===================================================================
--- trunk/pingus/src/pingus/worldobjs/surface_background.cpp 2009-11-05
23:10:49 UTC (rev 4043)
+++ trunk/pingus/src/pingus/worldobjs/surface_background.cpp 2009-11-05
23:13:19 UTC (rev 4044)
@@ -22,7 +22,7 @@
#include "pingus/world.hpp"
#include "pingus/resource.hpp"
#include "pingus/globals.hpp"
-#include "pingus/blitter.hpp"
+#include "engine/display/blitter.hpp"
#include "engine/display/display.hpp"
namespace WorldObjs {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r4044 - in trunk/pingus/src: editor engine/display pingus pingus/worldobjs,
grumbel at BerliOS <=