paragui-cvs
[Top][All Lists]
Advanced

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

[paragui-cvs] CVS: paragui/src/draw/opengl TODO,1.1.2.3,1.1.2.4 pgglcore


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/draw/opengl TODO,1.1.2.3,1.1.2.4 pgglcore.cpp,1.1.2.7,1.1.2.8 pgglroot.cpp,1.1.2.7,1.1.2.8 pgglsurf.cpp,1.1.2.9,1.1.2.10
Date: Sun, 26 Jan 2003 16:27:37 -0500

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

Modified Files:
      Tag: devel-opengl
        TODO pgglcore.cpp pgglroot.cpp pgglsurf.cpp 
Log Message:
fixed many opengl driver bugs.  Most things now work - although spotting 
colourkeying still doesn't.


Index: TODO
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/TODO,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** TODO        30 Oct 2002 09:16:29 -0000      1.1.2.3
--- TODO        26 Jan 2003 21:27:20 -0000      1.1.2.4
***************
*** 10,14 ****
  - most widgets aren't displayed.
        - Blits still need work
!       - Fonts do as well..
  
  - remove glSDL and make work directly with OpenGL     - DONE
--- 10,15 ----
  - most widgets aren't displayed.
        - Blits still need work
!       - Fonts do as well..  cacheing or equiv will speed up lots!
!               (300+fps lots)
  
  - remove glSDL and make work directly with OpenGL     - DONE
***************
*** 25,29 ****
        FIXME  - this is where a lot of problems are coming from...
  - too much debug code *g*
! - Fonts still don't render.
  
  -> make root screen not an SDL surface (publically) - make it a drawing
--- 26,30 ----
        FIXME  - this is where a lot of problems are coming from...
  - too much debug code *g*
! - Fonts still don't render. - DONE (slow)
  
  -> make root screen not an SDL surface (publically) - make it a drawing

Index: pgglcore.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pgglcore.cpp,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -r1.1.2.7 -r1.1.2.8
*** pgglcore.cpp        17 Jan 2003 23:13:08 -0000      1.1.2.7
--- pgglcore.cpp        26 Jan 2003 21:27:20 -0000      1.1.2.8
***************
*** 193,208 ****
  
  static void _key2alpha(SDL_Surface *surface) {
    int x, y;
    Uint32 ckey = surface->format->colorkey;
    if (SDL_LockSurface(surface) < 0) return;
!   
!   for (y = 0; y < surface->h; ++y)
!     {
!       Uint32 *px = (Uint32 *)((char *)surface->pixels + y*surface->pitch);
!       for(x = 0; x < surface->w; ++x)
!       if(px[x] == ckey)
!         px[x] = 0x00ff00ff;
!     }
    SDL_UnlockSurface(surface);
  }
  
--- 193,218 ----
  
  static void _key2alpha(SDL_Surface *surface) {
+   DBG(PG_LogMSG("%s:%i", __FUNCTION__, __LINE__));
    int x, y;
    Uint32 ckey = surface->format->colorkey;
    if (SDL_LockSurface(surface) < 0) return;
! 
!   switch (surface->format->BitsPerPixel) {
!   case 32: {
!     for (y = 0; y < surface->h; ++y)
!       {
!       Uint32 *px = (Uint32 *)((char *)surface->pixels + y*surface->pitch);
!       for(x = 0; x < surface->w; ++x)
!         if(px[x] == ckey)
!           px[x] = 0x00ff00ff /*0x00000000*/;
!       }
!     break;
!   };
!   default:
!     PG_LogERR("cannot key2alpha for depth %i", surface->format->BitsPerPixel);
!   };
!   DBG(PG_LogMSG("%s:%i", __FUNCTION__, __LINE__));
    SDL_UnlockSurface(surface);
+   DBG(PG_LogMSG("%s:%i", __FUNCTION__, __LINE__));
  }
  

Index: pgglroot.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pgglroot.cpp,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -r1.1.2.7 -r1.1.2.8
*** pgglroot.cpp        9 Nov 2002 12:00:35 -0000       1.1.2.7
--- pgglroot.cpp        26 Jan 2003 21:27:20 -0000      1.1.2.8
***************
*** 537,542 ****
--- 537,550 ----
       * ... actually 16x16 covers most characters happily but.. :)
       */
+ #if 0
      if (hx < 16) hx=32;
      if (hy < 16) hy=32;
+ #else
+     /* blocks of 32 */
+     hx >>= 5; hx++; hx<<=5;
+     hy >>= 5; hy++; hy<<=5;
+     // if (hx & (~0x1f) < hx) hx = (hx & (~0x1f)) + 0x20;
+     // if (hy & (~0x1f) < hy) hy = (hy & (~0x1f)) + 0x20;
+ #endif
  
      if (host->my_charSurface != NULL) {
***************
*** 557,560 ****
--- 565,569 ----
        host->my_charSurface = host->CreateDrawableSurface(SDL_SRCALPHA, 
BitmapRealWidth, Bitmap->rows, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
  #endif
+       /* PG_LogWRN("need : (%i,%i)", hx, hy); */
        host->my_charSurface = host->CreateDrawableSurfaceAlpha(hx, hy);
        if (host->my_charSurface == NULL) {
***************
*** 569,572 ****
--- 578,582 ----
      host->my_charSurface->FillRect(emptyrect, 0);
    }
+   host->my_charSurface->Lock();
    
    SourcePos.x = 0; // = host->my_charSurface->clip_rect;
***************
*** 600,607 ****
    raw_pixels = (Uint32 *) host->my_charSurface->GetPixels();
    Uint32 pitch_diff = 0;
    
    switch (Bitmap->pixel_mode) {
    case ft_pixel_mode_grays: {
!     Uint8     *SrcPix = Bitmap->buffer;
      int       a;
      
--- 610,623 ----
    raw_pixels = (Uint32 *) host->my_charSurface->GetPixels();
    Uint32 pitch_diff = 0;
+ 
+   int cr,cg,cb;
+   cr = Param->GetColor().r;
+   cg = Param->GetColor().g;
+   cb = Param->GetColor().b;
    
    switch (Bitmap->pixel_mode) {
    case ft_pixel_mode_grays: {
!     Uint32 src_pitch = Bitmap->pitch;
!     register Uint8* src_pixels = Bitmap->buffer;
      int       a;
      
***************
*** 609,615 ****
        double ioffset = Bitmap->rows * PG_FITALIC_ANGLE;
        
!       for (y = 0; y < Bitmap->rows; y++, SrcPix += Bitmap->pitch, ioffset -= 
PG_FITALIC_ANGLE) {
        for (x = 0; x <  Bitmap->width; x++) {
!         a = *(Uint8 *)(SrcPix++);
          
          // What the hell should do this ?
--- 625,634 ----
        double ioffset = Bitmap->rows * PG_FITALIC_ANGLE;
        
!       for (y = 0; y < Bitmap->rows; y++, src_pixels += src_pitch, ioffset -= 
PG_FITALIC_ANGLE) {
        for (x = 0; x <  Bitmap->width; x++) {
!         a = *(Uint8 *)(src_pixels++);
! 
!         // don't do anything if the pixel is fully transparent
!         // if (a == 0) { continue; }
          
          // What the hell should do this ?
***************
*** 617,630 ****
          //    a = (a * Param->GetAlpha()) / 255;
          
!         raw_pixels[int(ioffset) + x + 
(host->my_charSurface->GetPitch()/4)*(y)] = 
host->my_charSurface->MapRGBA(Param->GetColor().r, Param->GetColor().g, 
Param->GetColor().b, a);
        }
!       SrcPix -= x;
        }
      } else
        pitch_diff = (host->my_charSurface->GetPitch()/4);
      
!     for (y = 0; y < Bitmap->rows; y++, SrcPix += Bitmap->pitch) {
        for (x = 0; x <  Bitmap->width; x++) {
!       a = *(Uint8 *)(SrcPix++);
        
        // Q: What the hell should do this ?
--- 636,652 ----
          //    a = (a * Param->GetAlpha()) / 255;
          
!         raw_pixels[int(ioffset) + x + 
(host->my_charSurface->GetPitch()/4)*(y)] = 
host->my_charSurface->MapRGBA(cr,cg,cb,a);
        }
!       src_pixels -= x;
        }
      } else
        pitch_diff = (host->my_charSurface->GetPitch()/4);
      
!     for (y = 0; y < Bitmap->rows; y++, src_pixels += src_pitch) {
        for (x = 0; x <  Bitmap->width; x++) {
!       a = *(Uint8 *)(src_pixels++);
! 
!       // don't do anything if the pixel is fully transparent
!       // if (a == 0) { continue; }
        
        // Q: What the hell should do this ?
***************
*** 635,642 ****
          a = (a * Param->GetAlpha()) / 255;
        
!       *raw_pixels = host->my_charSurface->MapRGBA(Param->GetColor().r, 
Param->GetColor().g, Param->GetColor().b, a);
        raw_pixels++;
        }
!       SrcPix -= x;
        raw_pixels -= x;
        raw_pixels += pitch_diff;
--- 657,664 ----
          a = (a * Param->GetAlpha()) / 255;
        
!       *raw_pixels = host->my_charSurface->MapRGBA(cr,cg,cb,a);
        raw_pixels++;
        }
!       src_pixels -= x;
        raw_pixels -= x;
        raw_pixels += pitch_diff;
***************
*** 647,655 ****
--- 669,686 ----
    default:
      PG_LogWRN("Unknown pixel type in font !");
+     host->my_charSurface->Unlock();
      return false;
    }
    
+   host->my_charSurface->Unlock();
+   TargetPos.w = SourcePos.w;
+   TargetPos.h = SourcePos.h;
    // Final blit
    PG_Rect BoldTarget = TargetPos;
+ #if 0
+   PG_LogDBG("ParaGUI[%s]: %s:%i(%i,%i:%ix%i):(%i,%i:%ix%i)", __FILE__, 
__FUNCTION__, __LINE__,
+           SourcePos.x,SourcePos.y,SourcePos.h,SourcePos.w,
+           TargetPos.x,TargetPos.y,TargetPos.h,TargetPos.w);
+ #endif
    /*host->*/ BlitSurface(host->my_charSurface, SourcePos, TargetPos);
  

Index: pgglsurf.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pgglsurf.cpp,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -C2 -r1.1.2.9 -r1.1.2.10
*** pgglsurf.cpp        9 Nov 2002 12:00:35 -0000       1.1.2.9
--- pgglsurf.cpp        26 Jan 2003 21:27:20 -0000      1.1.2.10
***************
*** 233,237 ****
  
  int PG_GLDrawableSurface::SetColorKey(Uint32 flag, Uint32 key) {
!   // PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
    // return 0; // DEBUG
  
--- 233,237 ----
  
  int PG_GLDrawableSurface::SetColorKey(Uint32 flag, Uint32 key) {
!   PG_LogDBG("ParaGUI[%s]: %s:%i(%x:%x)", __FILE__, __FUNCTION__, 
__LINE__,flag,key);
    // return 0; // DEBUG
  
***************
*** 248,251 ****
--- 248,258 ----
     */
    host->FreeTexInfo(this);
+   /* regenerate texinfo */
+   switch (host->AddTexInfo(this)) {
+   case 0: break;
+   case -1: PG_LogERR("AddTexInfo returned: no screen"); break;
+   case -2: PG_LogERR("AddTexInfo returned: no texinfo"); break;
+   case -3: PG_LogERR("AddTexInfo returned: calc chop fail"); break;
+   };
    return res;
  };





reply via email to

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