paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/draw draw.cpp,1.1.2.8,1.1.2.9 drawable.cp


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/draw draw.cpp,1.1.2.8,1.1.2.9 drawable.cpp,1.1.2.6,1.1.2.7 drawfont.cpp,1.1.2.1,1.1.2.2 gradient.cpp,1.3.2.2,1.3.2.3 rotozoom.cpp,1.3.2.2,1.3.2.3 setpixel.cpp,1.3.2.1,1.3.2.2 stretch.cpp,1.3.2.2,1.3.2.3 surface.cpp,1.3.2.1,1.3.2.2
Date: Wed, 30 Oct 2002 04:16:32 -0500

Update of /cvsroot/paragui/paragui/src/draw
In directory subversions:/tmp/cvs-serv26981/src/draw

Modified Files:
      Tag: devel-opengl
        draw.cpp drawable.cpp drawfont.cpp gradient.cpp rotozoom.cpp 
        setpixel.cpp stretch.cpp surface.cpp 
Log Message:
Updating function names to be more consistent with ParaGUI
There's a persistant memory bug - somewhere - which is attempting to delete 
information already deleted.  Not all demos exhibit this, but paratest is 
amongst those that do.
Significant rewrite of most of OpenGL driver.  There's still more to be done 
and the driver as yet does not work correctly.  Any help would be quite 
appreciated but as I haven't received anything more than a couple comments yet 
I'm not holding my breath - T.


Index: draw.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/Attic/draw.cpp,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -r1.1.2.8 -r1.1.2.9
*** draw.cpp    24 Oct 2002 16:08:13 -0000      1.1.2.8
--- draw.cpp    30 Oct 2002 09:16:29 -0000      1.1.2.9
***************
*** 43,47 ****
    s->creator = this;
    surflist.push_back(s);
!   // PG_LogMSG("attach to creator %s", s->getCreator()->getName().c_str());
    return 0;
  };
--- 43,47 ----
    s->creator = this;
    surflist.push_back(s);
!   // PG_LogMSG("attach to creator %s", s->GetCreator()->GetName().c_str());
    return 0;
  };
***************
*** 374,377 ****
--- 374,383 ----
  };
  
+ PG_Draw::PG_DrawableSurface*
+ PG_Draw::PG_Draw::AccelerateSurface(PG_DrawableSurface* srf) {
+   if (srf == NULL) return NULL;
+   return AccelDrawableSurface(srf->ref);
+ };
+ 
  PG_Draw::PG_DrawableSurface* PG_Draw::PG_Draw::CreateGradient(const PG_Rect& 
r, PG_Gradient& gradient) {
  #if 1
***************
*** 425,428 ****
--- 431,439 ----
  };
  
+ void PG_Draw::PG_Draw::SetCursor(PG_DrawableSurface* cursor) {
+   /* just some housekeeping for now */
+   cursor->ref->refcount++;
+ };
+ 
  /* ParaGUI uses a different mouse cursor... */
  /* SDL_Cursor * CreateCursor(Uint8 *data, Uint8 *mask, int w, int h, int 
hot_x, int hot_y); */
***************
*** 430,431 ****
--- 441,495 ----
  /* SDL_Cursor * GetCursor(void); */
  /* void FreeCursor(SDL_Cursor *cursor); */
+ 
+ int PG_Draw::PG_Draw::SetIcon(PG_DrawableSurface* icon) {
+       Uint8* pixels;
+       Uint8* mask;
+       int mlen, i;
+       PG_LogDBG("ParaGUI: %s", __FUNCTION__);
+ 
+       // Check width and height
+       if ( (icon->GetWidth()%8) != 0 ) {
+               PG_LogWRN("Icon width must be a multiple of 8!");
+               return -1;
+       }
+       
+       //Check the palette
+       if ( icon->ref->format->palette == NULL ) {
+               PG_LogWRN("Icon must have a palette!");
+               return -1;
+       }
+ 
+       // Set the colorkey
+       icon->SetColorKey(SDL_SRCCOLORKEY, *((Uint8 *)icon->ref->pixels));
+ 
+       // Create the mask
+       pixels = (Uint8 *)icon->ref->pixels;
+       mlen = icon->GetWidth()*icon->GetHeight();
+       mask =  new Uint8[mlen/8];
+ 
+       if ( mask == NULL ) {
+               PG_LogWRN("Out of memory when allocating mask for icon !");
+               return -1;
+       }
+ 
+       memset(mask, 0, mlen/8);
+       for ( i=0; i<mlen; ) {
+               if ( pixels[i] != *pixels ) {
+                       mask[i/8] |= 0x01;
+               }
+ 
+               ++i;
+               if ( (i%8) != 0 ) {
+                       mask[i/8] <<= 1;
+               }
+       }
+ 
+       //Set icon
+       if ( icon != NULL ) {
+               SDL_WM_SetIcon(icon->ref, mask);
+       }
+ 
+       //Clean up
+       delete[] mask;
+       return 0;
+ };

Index: drawable.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/Attic/drawable.cpp,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -r1.1.2.6 -r1.1.2.7
*** drawable.cpp        24 Oct 2002 16:08:13 -0000      1.1.2.6
--- drawable.cpp        30 Oct 2002 09:16:29 -0000      1.1.2.7
***************
*** 107,110 ****
--- 107,111 ----
  };
  
+ /* calls SetClipRect([empty rectangle])???? */
  bool PG_Draw::PG_DrawableSurface::SetClipRect() {
    return (SDL_SetClipRect(ref, NULL) == SDL_TRUE);
***************
*** 121,128 ****
  #if 0
    PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
!   PG_LogMSG("src creator %s", srf_src->creator->getName().c_str());
!   PG_LogMSG("dst creator %s", creator->getName().c_str());
  #endif
!   if (srf_src->getCreator() != creator) {
      PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
      PG_LogERR("ERROR - source surface in BlitSurface is from alien driver!");
--- 122,129 ----
  #if 0
    PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
!   PG_LogMSG("src creator %s", srf_src->creator->GetName().c_str());
!   PG_LogMSG("dst creator %s", creator->GetName().c_str());
  #endif
!   if (srf_src->GetCreator() != creator) {
      PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
      PG_LogERR("ERROR - source surface in BlitSurface is from alien driver!");
***************
*** 167,170 ****
--- 168,179 ----
  };
  
+ Uint32 PG_Draw::PG_DrawableSurface::MapRGB(Uint8 r, Uint8 g, Uint8 b) {
+   return SDL_MapRGB(ref->format, r, g, b);
+ };
+ 
+ Uint32 PG_Draw::PG_DrawableSurface::MapRGBA(Uint8 r, Uint8 g, Uint8 b, Uint8 
a) {
+   return SDL_MapRGBA(ref->format, r, g, b, a);
+ };
+ 
  int PG_Draw::PG_DrawableSurface::FillRect(const PG_Rect& dstrect, Uint32 
color) {
    if (dstrect.IsNull())
***************
*** 195,197 ****
--- 204,294 ----
  void PG_Draw::PG_DrawableSurface::DrawGradient(const PG_Rect& rect, const 
SDL_Color & ul, const SDL_Color & ur, const SDL_Color & dl, const SDL_Color & 
dr) {
    ::PG_Draw::DrawGradient(this, rect, ul, ur, dl, dr);
+ };
+ 
+ /* local attributes:
+  * name    offset format                 meaning
+  * ------- ------ ---------------------  --------------
+  * pixels      -1 void*                  pixel data pointer
+  * width       -2 int                    screen width
+  * height      -3 int                    screen height
+  * depth       -4 int                    screen depth (bits/pixel)
+  * format      -5 SDL_PixelFormat*       pixel format
+  * SDL        -99 SDL_Surface*           used to be "GetScreen()"
+  * obsolete: virtual SDL_Surface* GetScreen();
+  */
+ int PG_Draw::PG_DrawableSurface::GetAttrOffset(std::string name) {
+   if (!name.compare("pixels", 0, 6)) return -1;
+   if (!name.compare("width",  0, 5)) return -2;
+   if (!name.compare("height", 0, 6)) return -3;
+   if (!name.compare("depth",  0, 5)) return -4;
+   if (!name.compare("format", 0, 6)) return -5;
+   if (!name.compare("SDL",    0, 3)) return -99;
+   return PG_AttribList::GetAttrOffset(name);
+ };
+ 
+ std::string PG_Draw::PG_DrawableSurface::GetAttribute(int offset)
+ {
+   char store[80];
+   std::string rv;
+   switch (offset)
+     {
+     case -1: {
+       sprintf(store, "Q%p", ref->pixels);
+       rv = std::string(store);
+       return rv;
+     };
+     case -2: {
+       sprintf(store, "I%i", GetWidth());
+       rv = std::string(store);
+       return rv;
+     };
+     case -3: {
+       sprintf(store, "I%i", GetHeight());
+       rv = std::string(store);
+       return rv;
+     };
+     case -4: {
+       sprintf(store, "I%i", GetDepth());
+       rv = std::string(store);
+       return rv;
+     };
+     case -5: {
+       sprintf(store, "Q%p", ref->format);
+       rv = std::string(store);
+       return rv;
+     };
+     case -99: {
+       sprintf(store, "Q%p", ref);
+       rv = std::string(store);
+       return rv;
+     };
+     default:  return PG_AttribList::GetAttribute(offset);
+     };
+ };
+ 
+ bool PG_Draw::PG_DrawableSurface::validAttribute(int offset) {
+   switch (offset)
+     {
+     case -1:
+     case -2:
+     case -3:
+     case -4:
+     case -5:
+     case -99: return true;
+     };
+   return PG_AttribList::validAttribute(offset);
+ };
+ 
+ bool PG_Draw::PG_DrawableSurface::setAttribute(int offset, std::string data) {
+   if (offset >= 0) return PG_AttribList::setAttribute(offset, data);
+   switch (offset)
+     {
+     case -1:
+     case -2:
+     case -3:
+     case -4:
+     case -5:
+     case -99: return false;
+     };
+   return PG_AttribList::setAttribute(offset, data);
  };

Index: drawfont.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/Attic/drawfont.cpp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** drawfont.cpp        7 Oct 2002 22:23:26 -0000       1.1.2.1
--- drawfont.cpp        30 Oct 2002 09:16:29 -0000      1.1.2.2
***************
*** 49,54 ****
    
    // PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
!   // PG_LogDBG("%s: handle %p", __FUNCTION__, Surface->getScreen());
!   SDL_PixelFormat* format = Surface->getScreen()->format;
    Uint8 Rloss = format->Rloss;
    Uint8 Gloss = format->Gloss;
--- 49,54 ----
    
    // PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
!   // PG_LogDBG("%s: handle %p", __FUNCTION__, Surface->GetScreen());
!   SDL_PixelFormat* format = Surface->GetFormat();
    Uint8 Rloss = format->Rloss;
    Uint8 Gloss = format->Gloss;
***************
*** 69,73 ****
  
        Uint8 bpp = format->BytesPerPixel;
!       Uint32 pitch = Surface->getScreen()->pitch;
        Uint32 src_pitch = Bitmap->pitch;
        register Uint8* src_pixels = Bitmap->buffer + x0 + y0*Bitmap->pitch;
--- 69,73 ----
  
        Uint8 bpp = format->BytesPerPixel;
!       Uint32 pitch = Surface->GetPitch();
        Uint32 src_pitch = Bitmap->pitch;
        register Uint8* src_pixels = Bitmap->buffer + x0 + y0*Bitmap->pitch;
***************
*** 110,114 ****
                        // Get the pixel
                        color = *((DT) (dst_pixels));
!                       if ( Surface->getScreen()->format->BytesPerPixel > 1 ) {
  
                                // get the RGBA values
--- 110,114 ----
                        // Get the pixel
                        color = *((DT) (dst_pixels));
!                       if ( Surface->GetFormat()->BytesPerPixel > 1 ) {
  
                                // get the RGBA values
***************
*** 247,259 ****
        }
        
!       switch(getScreen()->format->BytesPerPixel) {
        case 1: // PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, 
__LINE__);
!               BlitTemplate((Uint8*)getScreen()->pixels, this, Bitmap, PosX, 
PosY, x0, x1, y0, y1, Param);
                break;
        case 2:// PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, 
__LINE__);
!               BlitTemplate((Uint16*)getScreen()->pixels, this, Bitmap, PosX, 
PosY, x0, x1, y0, y1, Param);
                break;
        case 4:// PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, 
__LINE__);
!               BlitTemplate((Uint32*)getScreen()->pixels, this, Bitmap, PosX, 
PosY, x0, x1, y0, y1, Param);
                break;
        }
--- 247,259 ----
        }
        
!       switch(GetFormat()->BytesPerPixel) {
        case 1: // PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, 
__LINE__);
!               BlitTemplate((Uint8*)GetPixels(), this, Bitmap, PosX, PosY, x0, 
x1, y0, y1, Param);
                break;
        case 2:// PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, 
__LINE__);
!               BlitTemplate((Uint16*)GetPixels(), this, Bitmap, PosX, PosY, 
x0, x1, y0, y1, Param);
                break;
        case 4:// PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, 
__LINE__);
!               BlitTemplate((Uint32*)GetPixels(), this, Bitmap, PosX, PosY, 
x0, x1, y0, y1, Param);
                break;
        }
***************
*** 350,354 ****
                                        double ioffset = Bitmap->rows * 
PG_FITALIC_ANGLE;
  
!                                       for (y = 0; y < Bitmap->rows; y++, 
SrcPix += Bitmap->getScreen()->pitch, ioffset -= PG_FITALIC_ANGLE) {
                                                for (x = 0; x <  Bitmap->width; 
x++) {
                                                        a = *(Uint8 
*)(SrcPix++);
--- 350,354 ----
                                        double ioffset = Bitmap->rows * 
PG_FITALIC_ANGLE;
  
!                                       for (y = 0; y < Bitmap->rows; y++, 
SrcPix += Bitmap->GetPitch(), ioffset -= PG_FITALIC_ANGLE) {
                                                for (x = 0; x <  Bitmap->width; 
x++) {
                                                        a = *(Uint8 
*)(SrcPix++);
***************
*** 358,369 ****
                                                        //      a = (a * 
Param->Alpha) / 255;
  
!                                                       raw_pixels[int(ioffset) 
+ x + (my_charSurface->getScreen()->pitch/4)*(y)] = 
SDL_MapRGBA(my_charSurface->getScreen()->format, Param->Color.r, 
Param->Color.g, Param->Color.b, a);
                                                }
                                                SrcPix -= x;
                                        }
                                } else
!                                       pitch_diff = 
(my_charSurface->getScreen()->pitch/4);
  
!                               for (y = 0; y < Bitmap->rows; y++, SrcPix += 
Bitmap->getScreen()->pitch) {
                                        for (x = 0; x <  Bitmap->width; x++) {
                                                a = *(Uint8 *)(SrcPix++);
--- 358,369 ----
                                                        //      a = (a * 
Param->Alpha) / 255;
  
!                                                       raw_pixels[int(ioffset) 
+ x + (my_charSurface->GetPitch()/4)*(y)] = 
my_charSurface->MapRGBA(Param->Color.r, Param->Color.g, Param->Color.b, a);
                                                }
                                                SrcPix -= x;
                                        }
                                } else
!                                       pitch_diff = 
(my_charSurface->GetPitch()/4);
  
!                               for (y = 0; y < Bitmap->rows; y++, SrcPix += 
Bitmap->GetPitch()) {
                                        for (x = 0; x <  Bitmap->width; x++) {
                                                a = *(Uint8 *)(SrcPix++);
***************
*** 376,380 ****
                                                        a = (a * Param->Alpha) 
/ 255;
  
!                                               *raw_pixels = 
SDL_MapRGBA(my_charSurface->getScreen()->format, Param->Color.r, 
Param->Color.g, Param->Color.b, a);
                                                raw_pixels++;
                                        }
--- 376,380 ----
                                                        a = (a * Param->Alpha) 
/ 255;
  
!                                               *raw_pixels = 
my_charSurface->MapRGBA(GetFormat(), Param->Color.r, Param->Color.g, 
Param->Color.b, a);
                                                raw_pixels++;
                                        }

Index: gradient.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/gradient.cpp,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -r1.3.2.2 -r1.3.2.3
*** gradient.cpp        31 Aug 2002 04:01:23 -0000      1.3.2.2
--- gradient.cpp        30 Oct 2002 09:16:29 -0000      1.3.2.3
***************
*** 77,82 ****
        Sint32 v10,v11,v12;
  
!       Sint32 w = rect.my_width;
!       Sint32 h = rect.my_height;
  
      if (!surface)
--- 77,82 ----
        Sint32 v10,v11,v12;
  
!       Uint32 w = rect.my_width;
!       Uint32 h = rect.my_height;
  
      if (!surface)
***************
*** 86,96 ****
              return;
  
!     if (w > surface->getScreen()->w || h > surface->getScreen()->h)
              return;
  
!       Uint32 c1 = SDL_MapRGB(surface->getScreen()->format, ul.r, ul.g, ul.b);
!       Uint32 c2 = SDL_MapRGB(surface->getScreen()->format, ur.r, ur.g, ur.b);
!       Uint32 c3 = SDL_MapRGB(surface->getScreen()->format, dl.r, dl.g, dl.b);
!       Uint32 c4 = SDL_MapRGB(surface->getScreen()->format, dr.r, dr.g, dr.b);
  
        // solid color gradient ?
--- 86,96 ----
              return;
  
!     if (w > surface->GetWidth() || h > surface->GetHeight())
              return;
  
!       Uint32 c1 = surface->MapRGB(ul.r, ul.g, ul.b);
!       Uint32 c2 = surface->MapRGB(ur.r, ur.g, ur.b);
!       Uint32 c3 = surface->MapRGB(dl.r, dl.g, dl.b);
!       Uint32 c4 = surface->MapRGB(dr.r, dr.g, dr.b);
  
        // solid color gradient ?
***************
*** 143,147 ****
        b2 += v12 * ox;
  
!       SDL_PixelFormat* format = surface->getScreen()->format;
        Uint8 Rloss = 8+format->Rloss;
        Uint8 Gloss = 8+format->Gloss;
--- 143,147 ----
        b2 += v12 * ox;
  
!       SDL_PixelFormat* format = surface->GetFormat();
        Uint8 Rloss = 8+format->Rloss;
        Uint8 Gloss = 8+format->Gloss;
***************
*** 153,158 ****
  
        Uint8 bpp = format->BytesPerPixel;
!       Uint32 pitch = surface->getScreen()->pitch;
!       Uint8* bits = ((Uint8 *) surface->getScreen()->pixels) + (rect.y + oy)* 
pitch + (rect.x + ox)* bpp;
        Uint32 y_pitch = pitch*drawrect.h - bpp;
        register Uint32 pixel = 0;
--- 153,158 ----
  
        Uint8 bpp = format->BytesPerPixel;
!       Uint32 pitch = surface->GetPitch();
!       Uint8* bits = ((Uint8 *) surface->GetPixels()) + (rect.y + oy)* pitch + 
(rect.x + ox)* bpp;
        Uint32 y_pitch = pitch*drawrect.h - bpp;
        register Uint32 pixel = 0;
***************
*** 174,178 ****
  
  /*                    if ( bpp == 1 )
!                               pixel = SDL_MapRGB ( 
surface->getScreen()->format, r>>8, g>>8, b>>8 );
                        else
                                pixel =  (r>>Rloss) << Rshift
--- 174,178 ----
  
  /*                    if ( bpp == 1 )
!                               pixel = surface->MapRGB(r>>8, g>>8, b>>8);
                        else
                                pixel =  (r>>Rloss) << Rshift
***************
*** 184,188 ****
                        switch (bpp) {
                                case 1:
!                                       pixel = SDL_MapRGB ( 
surface->getScreen()->format, r>>8, g>>8, b>>8 );
                                        *((Uint8 *) (bits)) = (Uint8) pixel;
                                        break;
--- 184,188 ----
                        switch (bpp) {
                                case 1:
!                                       pixel = surface->MapRGB(r>>8, g>>8, 
b>>8);
                                        *((Uint8 *) (bits)) = (Uint8) pixel;
                                        break;
***************
*** 201,210 ****
                                                                   | (b>>Bloss) 
<< Bshift;
        
!                                               Uint8 ri = (pixel >> 
surface->getScreen()->format->Rshift) & 0xFF;
!                                               Uint8 gi = (pixel >> 
surface->getScreen()->format->Gshift) & 0xFF;
!                                               Uint8 bi = (pixel >> 
surface->getScreen()->format->Bshift) & 0xFF;
!                                               *((bits) + 
surface->getScreen()->format->Rshift / 8) = ri;
!                                               *((bits) + 
surface->getScreen()->format->Gshift / 8) = gi;
!                                               *((bits) + 
surface->getScreen()->format->Bshift / 8) = bi;
                                        }
                                        break;
--- 201,210 ----
                                                                   | (b>>Bloss) 
<< Bshift;
        
!                                               Uint8 ri = (pixel >> 
surface->GetFormat()->Rshift) & 0xFF;
!                                               Uint8 gi = (pixel >> 
surface->GetFormat()->Gshift) & 0xFF;
!                                               Uint8 bi = (pixel >> 
surface->GetFormat()->Bshift) & 0xFF;
!                                               *((bits) + 
surface->GetFormat()->Rshift / 8) = ri;
!                                               *((bits) + 
surface->GetFormat()->Gshift / 8) = gi;
!                                               *((bits) + 
surface->GetFormat()->Bshift / 8) = bi;
                                        }
                                        break;

Index: rotozoom.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/rotozoom.cpp,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -r1.3.2.2 -r1.3.2.3
*** rotozoom.cpp        31 Aug 2002 04:01:23 -0000      1.3.2.2
--- rotozoom.cpp        30 Oct 2002 09:16:29 -0000      1.3.2.3
***************
*** 57,61 ****
  // 32bit Zoomer with optional anti-aliasing by bilinear interpolation.
  // Zoomes 32bit RGBA/ABGR 'src' surface to 'dst' surface.
! static int zoomSurfaceRGBA (PG_Draw::PG_DrawableSurface * src, 
PG_Draw::PG_DrawableSurface * dst, bool smooth) {
        int x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy, ex, ey, t1, t2, 
sstep;
        tColorRGBA *c00, *c01, *c10, *c11;
--- 57,63 ----
  // 32bit Zoomer with optional anti-aliasing by bilinear interpolation.
  // Zoomes 32bit RGBA/ABGR 'src' surface to 'dst' surface.
! static int zoomSurfaceRGBA (PG_Draw::PG_DrawableSurface * src,
!                           PG_Draw::PG_DrawableSurface * dst,
!                           bool smooth) {
        int x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy, ex, ey, t1, t2, 
sstep;
        tColorRGBA *c00, *c01, *c10, *c11;
***************
*** 67,82 ****
                /* For interpolation: assume source dimension is one pixel */
                /* smaller to avoid overflow on right and bottom edge.     */
!               sx = (int) (65536.0 * (float) (src->getScreen()->w - 1) / 
(float) dst->getScreen()->w);
!               sy = (int) (65536.0 * (float) (src->getScreen()->h - 1) / 
(float) dst->getScreen()->h);
        } else {
!               sx = (int) (65536.0 * (float) src->getScreen()->w / (float) 
dst->getScreen()->w);
!               sy = (int) (65536.0 * (float) src->getScreen()->h / (float) 
dst->getScreen()->h);
        }
  
        /* Allocate memory for row increments */
!       if ((sax = (int *) malloc ((dst->getScreen()->w + 1) * sizeof 
(Uint32))) == NULL) {
                return (-1);
        }
!       if ((say = (int *) malloc ((dst->getScreen()->h + 1) * sizeof 
(Uint32))) == NULL) {
                free (sax);
                return (-1);
--- 69,85 ----
                /* For interpolation: assume source dimension is one pixel */
                /* smaller to avoid overflow on right and bottom edge.     */
!               sx = (int) (65536.0 * (float) (src->GetWidth() - 1) / (float) 
dst->GetWidth());
!               sy = (int) (65536.0 * (float) (src->GetHeight() - 1) / (float) 
dst->GetHeight());
        } else {
!               sx = (int) (65536.0 * (float) src->GetWidth() / (float) 
dst->GetWidth());
!               sy = (int) (65536.0 * (float) src->GetHeight() / (float) 
dst->GetHeight());
        }
  
        /* Allocate memory for row increments */
!       if ((sax = (int *) malloc ((dst->GetWidth() + 1) * sizeof (Uint32))) == 
NULL) {
                return (-1);
        }
!       if ((say = (int *) malloc ((dst->GetHeight() + 1) * sizeof (Uint32))) 
== NULL) {
!               fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
                free (sax);
                return (-1);
***************
*** 86,90 ****
        csx = 0;
        csax = sax;
!       for (x = 0; x <= dst->getScreen()->w; x++) {
                *csax = csx;
                csax++;
--- 89,93 ----
        csx = 0;
        csax = sax;
!       for (x = 0; x <= dst->GetWidth(); x++) {
                *csax = csx;
                csax++;
***************
*** 94,98 ****
        csy = 0;
        csay = say;
!       for (y = 0; y <= dst->getScreen()->h; y++) {
                *csay = csy;
                csay++;
--- 97,101 ----
        csy = 0;
        csay = say;
!       for (y = 0; y <= dst->GetHeight(); y++) {
                *csay = csy;
                csay++;
***************
*** 102,110 ****
  
        /* Pointer setup */
!       sp = csp = (tColorRGBA *) src->getScreen()->pixels;
!       dp = (tColorRGBA *) dst->getScreen()->pixels;
!       sgap = src->getScreen()->pitch - src->getScreen()->w * 4;
!       dgap = dst->getScreen()->pitch - dst->getScreen()->w * 4;
!       orderRGBA = (src->getScreen()->format->Rmask == 0x000000ff);
  
        /* Switch between interpolating and non-interpolating code */
--- 105,113 ----
  
        /* Pointer setup */
!       sp = csp = (tColorRGBA *) src->GetPixels();
!       dp = (tColorRGBA *) dst->GetPixels();
!       sgap = src->GetPitch() - src->GetWidth() * 4;
!       dgap = dst->GetPitch() - dst->GetWidth() * 4;
!       orderRGBA = (src->GetFormat()->Rmask == 0x000000ff);
  
        /* Switch between interpolating and non-interpolating code */
***************
*** 115,128 ****
                /* Scan destination */
                csay = say;
!               for (y = 0; y < dst->getScreen()->h; y++) {
                        /* Setup color source pointers */
                        c00 = csp;
                        c01 = csp;
                        c01++;
!                       c10 = (tColorRGBA *) ((Uint8 *) csp + 
src->getScreen()->pitch);
                        c11 = c10;
                        c11++;
                        csax = sax;
!                       for (x = 0; x < dst->getScreen()->w; x++) {
                                /* ABGR ordering */
                                /* Interpolate colors */
--- 118,131 ----
                /* Scan destination */
                csay = say;
!               for (y = 0; y < dst->GetHeight(); y++) {
                        /* Setup color source pointers */
                        c00 = csp;
                        c01 = csp;
                        c01++;
!                       c10 = (tColorRGBA *) ((Uint8 *) csp + src->GetPitch());
                        c11 = c10;
                        c11++;
                        csax = sax;
!                       for (x = 0; x < dst->GetWidth(); x++) {
                                /* ABGR ordering */
                                /* Interpolate colors */
***************
*** 153,157 ****
                        /* Advance source pointer */
                        csay++;
!                       csp = (tColorRGBA *) ((Uint8 *) csp + (*csay >> 16) * 
src->getScreen()->pitch);
                        /* Advance destination pointers */
                        dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
--- 156,160 ----
                        /* Advance source pointer */
                        csay++;
!                       csp = (tColorRGBA *) ((Uint8 *) csp + (*csay >> 16) * 
src->GetPitch());
                        /* Advance destination pointers */
                        dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
***************
*** 163,170 ****
  
                csay = say;
!               for (y = 0; y < dst->getScreen()->h; y++) {
                        sp = csp;
                        csax = sax;
!                       for (x = 0; x < dst->getScreen()->w; x++) {
                                /* Draw */
                                *dp = *sp;
--- 166,173 ----
  
                csay = say;
!               for (y = 0; y < dst->GetHeight(); y++) {
                        sp = csp;
                        csax = sax;
!                       for (x = 0; x < dst->GetWidth(); x++) {
                                /* Draw */
                                *dp = *sp;
***************
*** 177,181 ****
                        /* Advance source pointer */
                        csay++;
!                       csp = (tColorRGBA *) ((Uint8 *) csp + (*csay >> 16) * 
src->getScreen()->pitch);
                        /* Advance destination pointers */
                        dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
--- 180,184 ----
                        /* Advance source pointer */
                        csay++;
!                       csp = (tColorRGBA *) ((Uint8 *) csp + (*csay >> 16) * 
src->GetPitch());
                        /* Advance destination pointers */
                        dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
***************
*** 185,189 ****
--- 188,194 ----
  
        /* Remove temp arrays */
+       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        free (sax);
+       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        free (say);
  
***************
*** 201,213 ****
  
        /* Variable setup */
!       sx = (Uint32) (65536.0 * (float) src->getScreen()->w / (float) 
dst->getScreen()->w);
!       sy = (Uint32) (65536.0 * (float) src->getScreen()->h / (float) 
dst->getScreen()->h);
  
        /* Allocate memory for row increments */
!       if ((sax = (Uint32 *) malloc (dst->getScreen()->w * sizeof (Uint32))) 
== NULL) {
                return (-1);
        }
!       if ((say = (Uint32 *) malloc (dst->getScreen()->h * sizeof (Uint32))) 
== NULL) {
                if (sax != NULL) {
                        free (sax);
                }
--- 206,219 ----
  
        /* Variable setup */
!       sx = (Uint32) (65536.0 * (float) src->GetWidth() / (float) 
dst->GetWidth());
!       sy = (Uint32) (65536.0 * (float) src->GetHeight() / (float) 
dst->GetHeight());
  
        /* Allocate memory for row increments */
!       if ((sax = (Uint32 *) malloc (dst->GetWidth() * sizeof (Uint32))) == 
NULL) {
                return (-1);
        }
!       if ((say = (Uint32 *) malloc (dst->GetHeight() * sizeof (Uint32))) == 
NULL) {
                if (sax != NULL) {
+                       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, 
__LINE__);
                        free (sax);
                }
***************
*** 218,222 ****
        csx = 0;
        csax = sax;
!       for (x = 0; x < dst->getScreen()->w; x++) {
                csx += sx;
                *csax = (csx >> 16);
--- 224,228 ----
        csx = 0;
        csax = sax;
!       for (x = 0; x < dst->GetWidth(); x++) {
                csx += sx;
                *csax = (csx >> 16);
***************
*** 226,230 ****
        csy = 0;
        csay = say;
!       for (y = 0; y < dst->getScreen()->h; y++) {
                csy += sy;
                *csay = (csy >> 16);
--- 232,236 ----
        csy = 0;
        csay = say;
!       for (y = 0; y < dst->GetHeight(); y++) {
                csy += sy;
                *csay = (csy >> 16);
***************
*** 235,239 ****
        csx = 0;
        csax = sax;
!       for (x = 0; x < dst->getScreen()->w; x++) {
                csx += (*csax);
                csax++;
--- 241,245 ----
        csx = 0;
        csax = sax;
!       for (x = 0; x < dst->GetWidth(); x++) {
                csx += (*csax);
                csax++;
***************
*** 241,245 ****
        csy = 0;
        csay = say;
!       for (y = 0; y < dst->getScreen()->h; y++) {
                csy += (*csay);
                csay++;
--- 247,251 ----
        csy = 0;
        csay = say;
!       for (y = 0; y < dst->GetHeight(); y++) {
                csy += (*csay);
                csay++;
***************
*** 247,260 ****
  
        /* Pointer setup */
!       sp = csp = (Uint8 *) src->getScreen()->pixels;
!       dp = (Uint8 *) dst->getScreen()->pixels;
!       dgap = dst->getScreen()->pitch - dst->getScreen()->w;
  
        /* Draw */
        csay = say;
!       for (y = 0; y < dst->getScreen()->h; y++) {
                csax = sax;
                sp = csp;
!               for (x = 0; x < dst->getScreen()->w; x++) {
                        /* Draw */
                        *dp = *sp;
--- 253,266 ----
  
        /* Pointer setup */
!       sp = csp = (Uint8 *) src->GetPixels();
!       dp = (Uint8 *) dst->GetPixels();
!       dgap = dst->GetPitch() - dst->GetWidth();
  
        /* Draw */
        csay = say;
!       for (y = 0; y < dst->GetHeight(); y++) {
                csax = sax;
                sp = csp;
!               for (x = 0; x < dst->GetWidth(); x++) {
                        /* Draw */
                        *dp = *sp;
***************
*** 266,270 ****
                }
                /* Advance source pointer (for row) */
!               csp += ((*csay) * src->getScreen()->pitch);
                csay++;
                /* Advance destination pointers */
--- 272,276 ----
                }
                /* Advance source pointer (for row) */
!               csp += ((*csay) * src->GetPitch());
                csay++;
                /* Advance destination pointers */
***************
*** 273,277 ****
--- 279,285 ----
  
        /* Remove temp arrays */
+       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        free (sax);
+       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        free (say);
  
***************
*** 284,288 ****
  static void transformSurfaceRGBA (PG_Draw::PG_DrawableSurface * src, 
PG_Draw::PG_DrawableSurface * dst, int cx,
                                  int cy, int isin, int icos, bool smooth) {
!       int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
        tColorRGBA c00, c01, c10, c11;
        tColorRGBA *pc, *sp;
--- 292,297 ----
  static void transformSurfaceRGBA (PG_Draw::PG_DrawableSurface * src, 
PG_Draw::PG_DrawableSurface * dst, int cx,
                                  int cy, int isin, int icos, bool smooth) {
!       int x, y, t1, t2, dx, dy, xd, yd, ax, ay, ex, ey, sw, sh;
!       int sdx, sdy;
        tColorRGBA c00, c01, c10, c11;
        tColorRGBA *pc, *sp;
***************
*** 290,322 ****
  
        /* Variable setup */
!       xd = ((src->getScreen()->w - dst->getScreen()->w) << 15);
!       yd = ((src->getScreen()->h - dst->getScreen()->h) << 15);
        ax = (cx << 16) - (icos * cx);
        ay = (cy << 16) - (isin * cx);
!       sw = src->getScreen()->w - 1;
!       sh = src->getScreen()->h - 1;
!       pc = reinterpret_cast<tColorRGBA*>(dst->getScreen()->pixels);
!       gap = dst->getScreen()->pitch - dst->getScreen()->w * 4;
!       orderRGBA = (src->getScreen()->format->Rmask == 0x000000ff);
  
        /* Switch between interpolating and non-interpolating code */
        if (smooth) {
!               for (y = 0; y < dst->getScreen()->h; y++) {
                        dy = cy - y;
                        sdx = (ax + (isin * dy)) + xd;
                        sdy = (ay - (icos * dy)) + yd;
!                       for (x = 0; x < dst->getScreen()->w; x++) {
                                dx = (sdx >> 16);
                                dy = (sdy >> 16);
!                               if ((dx >= -1) && (dy >= -1) && (dx < 
src->getScreen()->w) && (dy < src->getScreen()->h)) {
                                        if ((dx >= 0) && (dy >= 0) && (dx < sw) 
&& (dy < sh)) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->getScreen()->pixels +
!                                                                   
src->getScreen()->pitch * dy);
                                                sp += dx;
                                                c00 = *sp;
                                                sp += 1;
                                                c01 = *sp;
!                                               sp = (tColorRGBA *) ((Uint8 *) 
sp + src->getScreen()->pitch);
                                                sp -= 1;
                                                c10 = *sp;
--- 299,331 ----
  
        /* Variable setup */
!       xd = ((src->GetWidth() - dst->GetWidth()) << 15);
!       yd = ((src->GetHeight() - dst->GetHeight()) << 15);
        ax = (cx << 16) - (icos * cx);
        ay = (cy << 16) - (isin * cx);
!       sw = src->GetWidth() - 1;
!       sh = src->GetHeight() - 1;
!       pc = reinterpret_cast<tColorRGBA*>(dst->GetPixels());
!       gap = dst->GetPitch() - dst->GetWidth() * 4;
!       orderRGBA = (src->GetFormat()->Rmask == 0x000000ff);
  
        /* Switch between interpolating and non-interpolating code */
        if (smooth) {
!               for (y = 0; y < dst->GetHeight(); y++) {
                        dy = cy - y;
                        sdx = (ax + (isin * dy)) + xd;
                        sdy = (ay - (icos * dy)) + yd;
!                       for (x = 0; x < dst->GetWidth(); x++) {
                                dx = (sdx >> 16);
                                dy = (sdy >> 16);
!                               if ((dx >= -1) && (dy >= -1) && (dx < 
src->GetWidth()) && (dy < src->GetHeight())) {
                                        if ((dx >= 0) && (dy >= 0) && (dx < sw) 
&& (dy < sh)) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->GetPixels() +
!                                                                   
src->GetPitch() * dy);
                                                sp += dx;
                                                c00 = *sp;
                                                sp += 1;
                                                c01 = *sp;
!                                               sp = (tColorRGBA *) ((Uint8 *) 
sp + src->GetPitch());
                                                sp -= 1;
                                                c10 = *sp;
***************
*** 325,330 ****
                                        } else if ((dx == sw) && (dy == sh)) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->getScreen()->pixels +
!                                                                   
src->getScreen()->pitch * dy);
                                                sp += dx;
                                                c00 = *sp;
--- 334,339 ----
                                        } else if ((dx == sw) && (dy == sh)) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->GetPixels() +
!                                                                   
src->GetPitch() * dy);
                                                sp += dx;
                                                c00 = *sp;
***************
*** 333,337 ****
                                                c11 = *pc;
                                        } else if ((dx == -1) && (dy == -1)) {
!                                               sp = (tColorRGBA *) 
(src->getScreen()->pixels);
                                                c00 = *pc;
                                                c01 = *pc;
--- 342,346 ----
                                                c11 = *pc;
                                        } else if ((dx == -1) && (dy == -1)) {
!                                               sp = (tColorRGBA *) 
(src->GetPixels());
                                                c00 = *pc;
                                                c01 = *pc;
***************
*** 339,346 ****
                                                c11 = *sp;
                                        } else if ((dx == -1) && (dy == sh)) {
!                                               sp = (tColorRGBA *) 
(src->getScreen()->pixels);
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->getScreen()->pixels +
!                                                                   
src->getScreen()->pitch * dy);
                                                c00 = *pc;
                                                c01 = *sp;
--- 348,355 ----
                                                c11 = *sp;
                                        } else if ((dx == -1) && (dy == sh)) {
!                                               sp = (tColorRGBA *) 
(src->GetPixels());
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->GetPixels() +
!                                                                   
src->GetPitch() * dy);
                                                c00 = *pc;
                                                c01 = *sp;
***************
*** 348,352 ****
                                                c11 = *pc;
                                        } else if ((dx == sw) && (dy == -1)) {
!                                               sp = (tColorRGBA *) 
(src->getScreen()->pixels);
                                                sp += dx;
                                                c00 = *pc;
--- 357,361 ----
                                                c11 = *pc;
                                        } else if ((dx == sw) && (dy == -1)) {
!                                               sp = (tColorRGBA *) 
(src->GetPixels());
                                                sp += dx;
                                                c00 = *pc;
***************
*** 356,368 ****
                                        } else if (dx == -1) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->getScreen()->pixels +
!                                                                   
src->getScreen()->pitch * dy);
                                                c00 = *pc;
                                                c01 = *sp;
                                                c10 = *pc;
!                                               sp = (tColorRGBA *) ((Uint8 *) 
sp + src->getScreen()->pitch);
                                                c11 = *sp;
                                        } else if (dy == -1) {
!                                               sp = (tColorRGBA *) 
(src->getScreen()->pixels);
                                                sp += dx;
                                                c00 = *pc;
--- 365,377 ----
                                        } else if (dx == -1) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->GetPixels() +
!                                                                   
src->GetPitch() * dy);
                                                c00 = *pc;
                                                c01 = *sp;
                                                c10 = *pc;
!                                               sp = (tColorRGBA *) ((Uint8 *) 
sp + src->GetPitch());
                                                c11 = *sp;
                                        } else if (dy == -1) {
!                                               sp = (tColorRGBA *) 
(src->GetPixels());
                                                sp += dx;
                                                c00 = *pc;
***************
*** 373,388 ****
                                        } else if (dx == sw) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->getScreen()->pixels +
!                                                                   
src->getScreen()->pitch * dy);
                                                sp += dx;
                                                c00 = *sp;
                                                c01 = *pc;
!                                               sp = (tColorRGBA *) ((Uint8 *) 
sp + src->getScreen()->pitch);
                                                c10 = *sp;
                                                c11 = *pc;
                                        } else if (dy == sh) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->getScreen()->pixels +
!                                                                   
src->getScreen()->pitch * dy);
                                                sp += dx;
                                                c00 = *sp;
--- 382,397 ----
                                        } else if (dx == sw) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->GetPixels() +
!                                                                   
src->GetPitch() * dy);
                                                sp += dx;
                                                c00 = *sp;
                                                c01 = *pc;
!                                               sp = (tColorRGBA *) ((Uint8 *) 
sp + src->GetPitch());
                                                c10 = *sp;
                                                c11 = *pc;
                                        } else if (dy == sh) {
                                                sp =
!                                                   (tColorRGBA *) ((Uint8 *) 
src->GetPixels() +
!                                                                   
src->GetPitch() * dy);
                                                sp += dx;
                                                c00 = *sp;
***************
*** 416,429 ****
                }
        } else {
!               for (y = 0; y < dst->getScreen()->h; y++) {
                        dy = cy - y;
                        sdx = (ax + (isin * dy)) + xd;
                        sdy = (ay - (icos * dy)) + yd;
!                       for (x = 0; x < dst->getScreen()->w; x++) {
                                dx = (short) (sdx >> 16);
                                dy = (short) (sdy >> 16);
!                               if ((dx >= 0) && (dy >= 0) && (dx < 
src->getScreen()->w) && (dy < src->getScreen()->h)) {
                                        sp =
!                                           (tColorRGBA *) ((Uint8 *) 
src->getScreen()->pixels + src->getScreen()->pitch * dy);
                                        sp += dx;
                                        *pc = *sp;
--- 425,438 ----
                }
        } else {
!               for (y = 0; y < dst->GetHeight(); y++) {
                        dy = cy - y;
                        sdx = (ax + (isin * dy)) + xd;
                        sdy = (ay - (icos * dy)) + yd;
!                       for (x = 0; x < dst->GetWidth(); x++) {
                                dx = (short) (sdx >> 16);
                                dy = (short) (sdy >> 16);
!                               if ((dx >= 0) && (dy >= 0) && (dx < 
src->GetWidth()) && (dy < src->GetHeight())) {
                                        sp =
!                                           (tColorRGBA *) ((Uint8 *) 
src->GetPixels() + src->GetPitch() * dy);
                                        sp += dx;
                                        *pc = *sp;
***************
*** 443,473 ****
  static void transformSurfaceY (PG_Draw::PG_DrawableSurface * src, 
PG_Draw::PG_DrawableSurface * dst,
                               int cx, int cy, int isin, int icos) {
!       int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh;
        tColorY *pc, *sp;
        int gap;
  
        /* Variable setup */
!       xd = ((src->getScreen()->w - dst->getScreen()->w) << 15);
!       yd = ((src->getScreen()->h - dst->getScreen()->h) << 15);
        ax = (cx << 16) - (icos * cx);
        ay = (cy << 16) - (isin * cx);
!       sw = src->getScreen()->w - 1;
!       sh = src->getScreen()->h - 1;
!       pc = reinterpret_cast<tColorY*>(dst->getScreen()->pixels);
!       gap = dst->getScreen()->pitch - dst->getScreen()->w;
        /* Clear surface to colorkey */
!       memset (pc, (unsigned char) (src->getScreen()->format->colorkey & 0xff),
!               dst->getScreen()->pitch * dst->getScreen()->h);
        /* Iterate through destination surface */
!       for (y = 0; y < dst->getScreen()->h; y++) {
                dy = cy - y;
                sdx = (ax + (isin * dy)) + xd;
                sdy = (ay - (icos * dy)) + yd;
!               for (x = 0; x < dst->getScreen()->w; x++) {
                        dx = (short) (sdx >> 16);
                        dy = (short) (sdy >> 16);
!                       if ((dx >= 0) && (dy >= 0) && (dx < 
src->getScreen()->w) && (dy < src->getScreen()->h)) {
!                               sp = (tColorY *) (src->getScreen()->pixels);
!                               sp += (src->getScreen()->pitch * dy + dx);
                                *pc = *sp;
                        }
--- 452,483 ----
  static void transformSurfaceY (PG_Draw::PG_DrawableSurface * src, 
PG_Draw::PG_DrawableSurface * dst,
                               int cx, int cy, int isin, int icos) {
!       Uint32 x, y, dx, dy, xd, yd, ax, ay, sw, sh;
!       int sdx, sdy;
        tColorY *pc, *sp;
        int gap;
  
        /* Variable setup */
!       xd = ((src->GetWidth() - dst->GetWidth()) << 15);
!       yd = ((src->GetHeight() - dst->GetHeight()) << 15);
        ax = (cx << 16) - (icos * cx);
        ay = (cy << 16) - (isin * cx);
!       sw = src->GetWidth() - 1;
!       sh = src->GetHeight() - 1;
!       pc = reinterpret_cast<tColorY*>(dst->GetPixels());
!       gap = dst->GetPitch() - dst->GetWidth();
        /* Clear surface to colorkey */
!       memset (pc, (unsigned char) (src->GetFormat()->colorkey & 0xff),
!               dst->GetPitch() * dst->GetHeight());
        /* Iterate through destination surface */
!       for (y = 0; y < dst->GetHeight(); y++) {
                dy = cy - y;
                sdx = (ax + (isin * dy)) + xd;
                sdy = (ay - (icos * dy)) + yd;
!               for (x = 0; x < dst->GetWidth(); x++) {
                        dx = (short) (sdx >> 16);
                        dy = (short) (sdy >> 16);
!                       if ((dx >= 0) && (dy >= 0) && (dx < src->GetWidth()) && 
(dy < src->GetHeight())) {
!                               sp = (tColorY *) (src->GetPixels());
!                               sp += (src->GetPitch() * dy + dx);
                                *pc = *sp;
                        }
***************
*** 509,514 ****
  
        /* Determine if source surface is 32bit or 8bit */
!       is32bit=(src->getScreen()->format->BitsPerPixel==32);
!       if ( (is32bit) || (src->getScreen()->format->BitsPerPixel==8)) {
                /* Use source surface 'as is' */
                rz_src=src;
--- 519,524 ----
  
        /* Determine if source surface is 32bit or 8bit */
!       is32bit=(src->GetFormat()->BitsPerPixel==32);
!       if ( (is32bit) || (src->GetFormat()->BitsPerPixel==8)) {
                /* Use source surface 'as is' */
                rz_src=src;
***************
*** 516,520 ****
        } else {
                /* New source surface is 32bit with a defined RGBA ordering */
!               rz_src = draw->CreateDrawableSurface(SDL_SWSURFACE, 
src->getScreen()->w, src->getScreen()->h, 32, 0x000000ff, 0x0000ff00, 
0x00ff0000, 0xff000000);
                PG_Rect emptyrect;
                rz_src->BlitSurface(src,emptyrect,emptyrect);
--- 526,530 ----
        } else {
                /* New source surface is 32bit with a defined RGBA ordering */
!               rz_src = draw->CreateDrawableSurface(SDL_SWSURFACE, 
src->GetWidth(), src->GetHeight(), 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 
0xff000000);
                PG_Rect emptyrect;
                rz_src->BlitSurface(src,emptyrect,emptyrect);
***************
*** 545,550 ****
  
                /* Determine destination width and height by rotating a 
centered source box */
!               x=rz_src->getScreen()->w/2;
!               y=rz_src->getScreen()->h/2;
                cx=canglezoom*x;
                cy=canglezoom*y;
--- 555,560 ----
  
                /* Determine destination width and height by rotating a 
centered source box */
!               x=rz_src->GetWidth()/2;
!               y=rz_src->GetHeight()/2;
                cx=canglezoom*x;
                cy=canglezoom*y;
***************
*** 560,564 ****
                if (is32bit) {
                        /* Target surface is 32bit with source RGBA/ABGR 
ordering */
!                       rz_dst = draw->CreateDrawableSurface(SDL_SWSURFACE, 
dstwidth, dstheight, 32, rz_src->getScreen()->format->Rmask, 
rz_src->getScreen()->format->Gmask, rz_src->getScreen()->format->Bmask, 
rz_src->getScreen()->format->Amask);
                } else {
                        /* Target surface is 8bit */
--- 570,574 ----
                if (is32bit) {
                        /* Target surface is 32bit with source RGBA/ABGR 
ordering */
!                       rz_dst = draw->CreateDrawableSurface(SDL_SWSURFACE, 
dstwidth, dstheight, 32, rz_src->GetFormat()->Rmask, 
rz_src->GetFormat()->Gmask, rz_src->GetFormat()->Bmask, 
rz_src->GetFormat()->Amask);
                } else {
                        /* Target surface is 8bit */
***************
*** 579,591 ****
                } else {
                        /* Copy palette and colorkey info */
!                       for (i=0; 
i<rz_src->getScreen()->format->palette->ncolors; i++) {
!                               
rz_dst->getScreen()->format->palette->colors[i]=rz_src->getScreen()->format->palette->colors[i];
                        }
!                       
rz_dst->getScreen()->format->palette->ncolors=rz_src->getScreen()->format->palette->ncolors;
                        /* Call the 8bit transformation routine to do the 
rotation */
                        
transformSurfaceY(rz_src,rz_dst,dstwidthhalf,dstheighthalf,
                                          (int)(sanglezoominv),
                                          (int)(canglezoominv));
!                       rz_dst->SetColorKey(SDL_SRCCOLORKEY | SDL_RLEACCEL, 
rz_src->getScreen()->format->colorkey);
                }
                /* Unlock source surface */
--- 589,601 ----
                } else {
                        /* Copy palette and colorkey info */
!                       for (i=0; i<rz_src->GetFormat()->palette->ncolors; i++) 
{
!                               
rz_dst->GetFormat()->palette->colors[i]=rz_src->GetFormat()->palette->colors[i];
                        }
!                       
rz_dst->GetFormat()->palette->ncolors=rz_src->GetFormat()->palette->ncolors;
                        /* Call the 8bit transformation routine to do the 
rotation */
                        
transformSurfaceY(rz_src,rz_dst,dstwidthhalf,dstheighthalf,
                                          (int)(sanglezoominv),
                                          (int)(canglezoominv));
!                       rz_dst->SetColorKey(SDL_SRCCOLORKEY | SDL_RLEACCEL, 
rz_src->GetFormat()->colorkey);
                }
                /* Unlock source surface */
***************
*** 598,603 ****
  
                /* Calculate target size and set rect */
!               dstwidth=(int)((double)rz_src->getScreen()->w*zoom);
!               dstheight=(int)((double)rz_src->getScreen()->h*zoom);
                if (dstwidth<1) {
                        dstwidth=1;
--- 608,613 ----
  
                /* Calculate target size and set rect */
!               dstwidth=(int)((double)rz_src->GetWidth()*zoom);
!               dstheight=(int)((double)rz_src->GetHeight()*zoom);
                if (dstwidth<1) {
                        dstwidth=1;
***************
*** 611,615 ****
                if (is32bit) {
                        /* Target surface is 32bit with source RGBA/ABGR 
ordering */
!                       rz_dst = draw->CreateDrawableSurface(SDL_SWSURFACE, 
dstwidth, dstheight, 32, rz_src->getScreen()->format->Rmask, 
rz_src->getScreen()->format->Gmask, rz_src->getScreen()->format->Bmask, 
rz_src->getScreen()->format->Amask);
                } else {
                        /* Target surface is 8bit */
--- 621,625 ----
                if (is32bit) {
                        /* Target surface is 32bit with source RGBA/ABGR 
ordering */
!                       rz_dst = draw->CreateDrawableSurface(SDL_SWSURFACE, 
dstwidth, dstheight, 32, rz_src->GetFormat()->Rmask, 
rz_src->GetFormat()->Gmask, rz_src->GetFormat()->Bmask, 
rz_src->GetFormat()->Amask);
                } else {
                        /* Target surface is 8bit */
***************
*** 627,637 ****
                } else {
                        /* Copy palette and colorkey info */
!                       for (i=0; 
i<rz_src->getScreen()->format->palette->ncolors; i++) {
!                               
rz_dst->getScreen()->format->palette->colors[i]=rz_src->getScreen()->format->palette->colors[i];
                        }
!                       
rz_dst->getScreen()->format->palette->ncolors=rz_src->getScreen()->format->palette->ncolors;
                        /* Call the 8bit transformation routine to do the 
zooming */
                        zoomSurfaceY(rz_src,rz_dst);
!                       rz_dst->SetColorKey(SDL_SRCCOLORKEY | SDL_RLEACCEL, 
rz_src->getScreen()->format->colorkey);
                }
                /* Unlock source surface */
--- 637,647 ----
                } else {
                        /* Copy palette and colorkey info */
!                       for (i=0; i<rz_src->GetFormat()->palette->ncolors; i++) 
{
!                               
rz_dst->GetFormat()->palette->colors[i]=rz_src->GetFormat()->palette->colors[i];
                        }
!                       
rz_dst->GetFormat()->palette->ncolors=rz_src->GetFormat()->palette->ncolors;
                        /* Call the 8bit transformation routine to do the 
zooming */
                        zoomSurfaceY(rz_src,rz_dst);
!                       rz_dst->SetColorKey(SDL_SRCCOLORKEY | SDL_RLEACCEL, 
rz_src->GetFormat()->colorkey);
                }
                /* Unlock source surface */
***************
*** 670,675 ****
  
        /* Determine if source surface is 32bit or 8bit */
!       is32bit=(src->getScreen()->format->BitsPerPixel==32);
!       if ( (is32bit) || (src->getScreen()->format->BitsPerPixel==8)) {
                /* Use source surface 'as is' */
                rz_src=src;
--- 680,685 ----
  
        /* Determine if source surface is 32bit or 8bit */
!       is32bit=(src->GetFormat()->BitsPerPixel==32);
!       if ( (is32bit) || (src->GetFormat()->BitsPerPixel==8)) {
                /* Use source surface 'as is' */
                rz_src=src;
***************
*** 677,681 ****
        } else {
                /* New source surface is 32bit with a defined RGBA ordering */
!               rz_src = draw->CreateDrawableSurface(SDL_SWSURFACE, 
src->getScreen()->w, src->getScreen()->h, 32, 0x000000ff, 0x0000ff00, 
0x00ff0000, 0xff000000);
                PG_Rect emptyrect;
                rz_src->BlitSurface(src,emptyrect,emptyrect);
--- 687,691 ----
        } else {
                /* New source surface is 32bit with a defined RGBA ordering */
!               rz_src = draw->CreateDrawableSurface(SDL_SWSURFACE, 
src->GetWidth(), src->GetHeight(), 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 
0xff000000);
                PG_Rect emptyrect;
                rz_src->BlitSurface(src,emptyrect,emptyrect);
***************
*** 693,698 ****
  
        /* Calculate target size and set rect */
!       dstwidth=(int)((double)rz_src->getScreen()->w*zoomx);
!       dstheight=(int)((double)rz_src->getScreen()->h*zoomy);
        if (dstwidth<1) {
                dstwidth=1;
--- 703,708 ----
  
        /* Calculate target size and set rect */
!       dstwidth=(int)((double)rz_src->GetWidth()*zoomx);
!       dstheight=(int)((double)rz_src->GetHeight()*zoomy);
        if (dstwidth<1) {
                dstwidth=1;
***************
*** 706,710 ****
        if (is32bit) {
                /* Target surface is 32bit with source RGBA/ABGR ordering */
!               rz_dst = draw->CreateDrawableSurface(SDL_SWSURFACE, dstwidth, 
dstheight, 32, rz_src->getScreen()->format->Rmask, 
rz_src->getScreen()->format->Gmask, rz_src->getScreen()->format->Bmask, 
rz_src->getScreen()->format->Amask);
        } else {
                /* Target surface is 8bit */
--- 716,720 ----
        if (is32bit) {
                /* Target surface is 32bit with source RGBA/ABGR ordering */
!               rz_dst = draw->CreateDrawableSurface(SDL_SWSURFACE, dstwidth, 
dstheight, 32, rz_src->GetFormat()->Rmask, rz_src->GetFormat()->Gmask, 
rz_src->GetFormat()->Bmask, rz_src->GetFormat()->Amask);
        } else {
                /* Target surface is 8bit */
***************
*** 722,732 ****
        } else {
                /* Copy palette and colorkey info */
!               for (i=0; i<rz_src->getScreen()->format->palette->ncolors; i++) 
{
!                       
rz_dst->getScreen()->format->palette->colors[i]=rz_src->getScreen()->format->palette->colors[i];
                }
!               
rz_dst->getScreen()->format->palette->ncolors=rz_src->getScreen()->format->palette->ncolors;
                /* Call the 8bit transformation routine to do the zooming */
                zoomSurfaceY(rz_src,rz_dst);
!               rz_dst->SetColorKey(SDL_SRCCOLORKEY | SDL_RLEACCEL, 
rz_src->getScreen()->format->colorkey);
        }
        /* Unlock source surface */
--- 732,742 ----
        } else {
                /* Copy palette and colorkey info */
!               for (i=0; i<rz_src->GetFormat()->palette->ncolors; i++) {
!                       
rz_dst->GetFormat()->palette->colors[i]=rz_src->GetFormat()->palette->colors[i];
                }
!               
rz_dst->GetFormat()->palette->ncolors=rz_src->GetFormat()->palette->ncolors;
                /* Call the 8bit transformation routine to do the zooming */
                zoomSurfaceY(rz_src,rz_dst);
!               rz_dst->SetColorKey(SDL_SRCCOLORKEY | SDL_RLEACCEL, 
rz_src->GetFormat()->colorkey);
        }
        /* Unlock source surface */
***************
*** 745,750 ****
        PG_DrawableSurface *tmp =
                ScaleSurface(src,
!                            static_cast<double>(dst->getScreen()->w) / 
src->getScreen()->w,
!                            static_cast<double>(dst->getScreen()->h) / 
src->getScreen()->h,
                             smooth);
        PG_Rect emptyrect;
--- 755,760 ----
        PG_DrawableSurface *tmp =
                ScaleSurface(src,
!                            static_cast<double>(dst->GetWidth()) / 
src->GetWidth(),
!                            static_cast<double>(dst->GetHeight()) / 
src->GetHeight(),
                             smooth);
        PG_Rect emptyrect;

Index: setpixel.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/setpixel.cpp,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -r1.3.2.1 -r1.3.2.2
*** setpixel.cpp        18 Jun 2002 22:40:38 -0000      1.3.2.1
--- setpixel.cpp        30 Oct 2002 09:16:29 -0000      1.3.2.2
***************
*** 46,50 ****
        static PG_Rect rect;
        static SDL_PixelFormat* format;
!       format = surface->getScreen()->format;
  
        surface->GetClipRect(rect);
--- 46,50 ----
        static PG_Rect rect;
        static SDL_PixelFormat* format;
!       format = surface->GetFormat();
  
        surface->GetClipRect(rect);
***************
*** 59,63 ****
  
        bpp = format->BytesPerPixel;
!       bits = ((Uint8 *) surface->getScreen()->pixels) + y * 
surface->getScreen()->pitch + x * bpp;
  
        if(!((old_r==r) && (old_g==g) && (old_b==b))) {
--- 59,63 ----
  
        bpp = format->BytesPerPixel;
!       bits = ((Uint8 *) surface->GetPixels()) + y * surface->GetPitch() + x * 
bpp;
  
        if(!((old_r==r) && (old_g==g) && (old_b==b))) {

Index: stretch.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/stretch.cpp,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -r1.3.2.2 -r1.3.2.3
*** stretch.cpp 31 Aug 2002 04:01:23 -0000      1.3.2.2
--- stretch.cpp 30 Oct 2002 09:16:29 -0000      1.3.2.3
***************
*** 540,549 ****
--- 540,552 ----
        }
  
+       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        free(raster);
  
        /* free the memory allocated for horizontal filter weights */
        for (i = 0; i < tmp_w; ++i) {
+               fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
                free(contrib[i].p);
        }
+       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        free(contrib);
  
***************
*** 627,636 ****
--- 630,642 ----
        }
  
+       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        free(raster);
  
        /* free the memory allocated for vertical filter weights */
        for (i = 0; i < tmp_h; ++i) {
+               fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
                free(contrib[i].p);
        }
+       fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
        free(contrib);
  

Index: surface.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/surface.cpp,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -r1.3.2.1 -r1.3.2.2
*** surface.cpp 18 Jun 2002 22:40:38 -0000      1.3.2.1
--- surface.cpp 30 Oct 2002 09:16:29 -0000      1.3.2.2
***************
*** 301,306 ****
    
    if(((gradient == NULL) || (blend == 0)) && bColorKey) {
!     c = SDL_MapRGB(
!                  background->ref->format,
                   (uColorKey>>16) & 0xFF,
                   (uColorKey>>8) & 0xFF,
--- 301,305 ----
    
    if(((gradient == NULL) || (blend == 0)) && bColorKey) {
!     c = background->MapRGB(
                   (uColorKey>>16) & 0xFF,
                   (uColorKey>>8) & 0xFF,
***************
*** 308,315 ****
      background->SetColorKey(SDL_SRCCOLORKEY, c);
      
!     c = SDL_MapRGB(ref->format,
!                  (uColorKey>>16) & 0xFF,
!                  (uColorKey>>8) & 0xFF,
!                  uColorKey & 0xFF);
      this->SetColorKey(SDL_SRCCOLORKEY, c);
    }
--- 307,313 ----
      background->SetColorKey(SDL_SRCCOLORKEY, c);
      
!     c = MapRGB((uColorKey>>16) & 0xFF,
!              (uColorKey>>8) & 0xFF,
!              uColorKey & 0xFF);
      this->SetColorKey(SDL_SRCCOLORKEY, c);
    }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]