Bug#674299: Patch for GCC 4.7 build failure

Gregor Jasny gjasny at googlemail.com
Sun May 27 00:23:14 UTC 2012


tags 674299 + patch
thanks

Hello,

attached you'll find two patches to fix the GCC 4.7 build failures.
Number one comes from upstream and number two was created by me. It
moves the lighten_Color stuff into a separate header to have it
available in the blitter.h template regardless of the include order.

Thanks,
Gregor

-------------- next part --------------
Description: Fix remaining GCC 4.7 build failures
Author: Gregor Jasny <gjasny at googlemail.com>

--- a/source/graphics/blitter.h
+++ b/source/graphics/blitter.h
@@ -30,6 +30,7 @@
 #include "../misc.h"
  #include "../palette.h"
  #include "../basegfx.h"
+#include "lighten.h"
 
 typedef SDLmm::Color Color;
 
--- a/source/graphics/drawing.h
+++ b/source/graphics/drawing.h
@@ -31,6 +31,7 @@
 #include "../misc.h"
  #include "../palette.h"
  // #include "../basegfx.h"
+#include "lighten.h"
 
 
 
@@ -128,30 +129,6 @@
 
 extern char saturationTranslationTable[256][256];
 
-
-inline SDLmm::Color lighten_Color( SDLmm::Color color, int factor16 )
-{
-   return saturationTranslationTable[color & 0xff][factor16] |
-          (saturationTranslationTable[(color >> 8) & 0xff][factor16] << 8 ) |
-          (saturationTranslationTable[(color >> 16) & 0xff][factor16] << 16 ) |
-          (color & 0xff000000);
-}
-
-inline void lighten_Color( SDLmm::Color* color, int factor16 )
-{
-   *color = lighten_Color( *color, factor16 );
-};
-
-inline SDL_Color lighten_Color( const SDL_Color& color, int factor16 )
-{
-   SDL_Color c  = color;
-   c.r =  saturationTranslationTable[color.r & 0xff][factor16];
-   c.g =  saturationTranslationTable[color.g & 0xff][factor16];
-   c.b =  saturationTranslationTable[color.b & 0xff][factor16];
-   return c;
-}
-
-
 template< int pixelsize,
 template<int> class ColorMerger >
 class PutPixel: public ColorMerger<pixelsize>
@@ -169,7 +146,7 @@
          PixelType* pix = (PixelType*)( surf.pixels() );
          pix += pos.y * surf.pitch()/pixelsize + pos.x;
 
-         assign ( src, pix );
+         this->assign ( src, pix );
       };
 };
 
--- a/source/itemrepository.cpp
+++ b/source/itemrepository.cpp
@@ -88,7 +88,7 @@
    t->filename = fileName;
    t->location = location;
    t->archive = prc.getArchive();
-   add ( t );
+   this->add ( t );
 }
 
 
@@ -110,7 +110,7 @@
       t->archive = stream.readString();
       dataLoaderTicker();
 
-      add ( t );
+      this->add ( t );
       // add ( T::newFromStream(stream ));
    }
 }
--- /dev/null
+++ b/source/graphics/lighten.h
@@ -0,0 +1,60 @@
+/*
+    This file is part of Advanced Strategic Command; http://www.asc-hq.de
+    Copyright (C) 1994-2004  Martin Bickel  and  Marc Schellenberger
+ 
+    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 2 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; see the file COPYING. If not, write to the
+    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+    Boston, MA  02111-1307  USA
+*/
+
+#ifndef lightenH
+ #define lightenH
+
+#include <cmath>
+ #include <map>
+ #include "loki/static_check.h"
+ #include "../libs/sdlmm/src/sdlmm.h"
+ #include "surface.h"
+
+#include "../misc.h"
+ #include "../palette.h"
+ // #include "../basegfx.h"
+
+extern char saturationTranslationTable[256][256];
+
+
+inline SDLmm::Color lighten_Color( SDLmm::Color color, int factor16 )
+{
+   return saturationTranslationTable[color & 0xff][factor16] |
+          (saturationTranslationTable[(color >> 8) & 0xff][factor16] << 8 ) |
+          (saturationTranslationTable[(color >> 16) & 0xff][factor16] << 16 ) |
+          (color & 0xff000000);
+}
+
+inline void lighten_Color( SDLmm::Color* color, int factor16 )
+{
+   *color = lighten_Color( *color, factor16 );
+};
+
+inline SDL_Color lighten_Color( const SDL_Color& color, int factor16 )
+{
+   SDL_Color c  = color;
+   c.r =  saturationTranslationTable[color.r & 0xff][factor16];
+   c.g =  saturationTranslationTable[color.g & 0xff][factor16];
+   c.b =  saturationTranslationTable[color.b & 0xff][factor16];
+   return c;
+}
+
+#endif
+
-------------- next part --------------
Description: Fixed gcc 4.7 compilation problems
Origin: upstream, 205e73929e9576f4abfdde7188bef381396b8ce1
Author: Martin Bickel <martin at asc-hq.org>

diff -r 83e224cdaf50 -r 205e73929e95 source/graphics/blitter.h
--- a/source/graphics/blitter.h	Sun May 13 15:41:46 2012 +0200
+++ b/source/graphics/blitter.h	Wed May 16 19:17:17 2012 +0200
@@ -749,7 +749,7 @@
 
       void assign ( PixelType src, PixelType* dest )
       {
-         if ( isOpaque(src ) ) {
+         if ( this->isOpaque(src ) ) {
             *dest = src;
          }
       };
@@ -769,7 +769,7 @@
 
       void assign ( PixelType src, PixelType* dest )
       {
-         if ( isOpaque(src ) ) {
+         if ( this->isOpaque(src ) ) {
             *dest = src;
          }
       };
@@ -846,7 +846,7 @@
       void assign ( PixelType src, PixelType* dest )
       {
          // STATIC_CHECK ( pixelsize == 1, wrong_pixel_size );
-         if ( isOpaque(src ) ) {
+         if ( this->isOpaque(src ) ) {
             *dest = table[*dest];
          }
       };
@@ -873,7 +873,7 @@
 
       void assign ( PixelType src, PixelType* dest )
       {
-         if ( isOpaque(src ) ) {
+         if ( this->isOpaque(src ) ) {
             *dest = ((*dest >> 1) & 0x7f7f7f7f) | (*dest & 0xff000000 );
          }
       };
@@ -901,7 +901,7 @@
    protected:
       void assign ( PixelType src, PixelType* dest )
       {
-         if ( isOpaque(src ) )
+         if ( this->isOpaque(src ) )
             *dest = colormixbufchar[*dest + src*256 ];
       };
    public:
@@ -918,7 +918,7 @@
       void assign ( PixelType src, PixelType* dest )
       {
          // STATIC_CHECK ( pixelsize == 1, wrong_pixel_size );
-         if ( isOpaque(src ) ) {
+         if ( this->isOpaque(src ) ) {
             *dest = ((*dest >> 1) & 0x7f7f7f7f) + ((src >> 1) & 0x7f7f7f7f);
          }
       };
@@ -975,7 +975,7 @@
       void assign ( PixelType src, PixelType* dest )
       {
          // STATIC_CHECK ( pixelsize == 1, wrong_pixel_size );
-         if ( isOpaque(src ) ) {
+         if ( this->isOpaque(src ) ) {
             *dest = table[ *dest + src*256 ];
          }
       };
diff -r 83e224cdaf50 -r 205e73929e95 source/graphics/surface.cpp
--- a/source/graphics/surface.cpp	Sun May 13 15:41:46 2012 +0200
+++ b/source/graphics/surface.cpp	Wed May 16 19:17:17 2012 +0200
@@ -579,7 +579,7 @@
 
       void assign ( PixelType src, PixelType* dest )
       {
-         if ( !isOpaque(src ) )
+         if ( !this->isOpaque(src ) )
             *dest &= alphamask;
       };
 



More information about the Pkg-games-devel mailing list