paragui-cvs
[Top][All Lists]
Advanced

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

[paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.10,1.10.2.1 pgfi


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.10,1.10.2.1 pgfilearchive.cpp,1.4,1.4.2.1 pgrectlist.cpp,1.2,1.2.2.1 pgsurfacecache.cpp,1.2,1.2.2.1 physfsrwops.h,1.1,1.1.4.1
Date: Tue, 18 Jun 2002 18:40:41 -0400

Update of /cvsroot/paragui/paragui/src/core
In directory subversions:/tmp/cvs-serv27818/src/core

Modified Files:
      Tag: devel-opengl
        pgapplication.cpp pgfilearchive.cpp pgrectlist.cpp 
        pgsurfacecache.cpp physfsrwops.h 
Log Message:
Initial checkin of code by Teunis Peters
Added abstraction layer for display support.
Initial OpenGL testing mode - use SDL_GLSDL to activate
A lot of test code is still present - FIXME
Some demos do not operate at all.  Some work barely.
only animation works flawlessly at this time.


Index: pgapplication.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgapplication.cpp,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -r1.10 -r1.10.2.1
*** pgapplication.cpp   6 May 2002 11:18:03 -0000       1.10
--- pgapplication.cpp   18 Jun 2002 22:40:38 -0000      1.10.2.1
***************
*** 49,53 ****
  SDL_mutex* PG_Application::mutexScreen = NULL;
  PG_Application* PG_Application::pGlobalApp = NULL;
! SDL_Surface* PG_Application::screen = NULL;
  std::string PG_Application::app_path = "";
  PG_Theme* PG_Application::my_Theme = NULL;
--- 49,53 ----
  SDL_mutex* PG_Application::mutexScreen = NULL;
  PG_Application* PG_Application::pGlobalApp = NULL;
! PG_Draw::PG_DrawableSurface* PG_Application::screen = NULL;
  std::string PG_Application::app_path = "";
  PG_Theme* PG_Application::my_Theme = NULL;
***************
*** 57,66 ****
  bool PG_Application::enableBackground = true;
  bool PG_Application::enableAppIdleCalls = false;
! SDL_Surface *PG_Application::my_mouse_pointer;
  PG_Rect PG_Application::my_mouse_position = PG_Rect(0,0,0,0);
  PG_CURSOR_MODE PG_Application::my_mouse_mode = PG_CURSOR_HARDWARE;
  PG_Font* PG_Application::DefaultFont = NULL;
! SDL_Surface* PG_Application::my_background;
! SDL_Surface* PG_Application::my_scaled_background;
  SDL_Color PG_Application::my_backcolor;
  int PG_Application::my_backmode;
--- 57,66 ----
  bool PG_Application::enableBackground = true;
  bool PG_Application::enableAppIdleCalls = false;
! PG_Draw::PG_DrawableSurface *PG_Application::my_mouse_pointer;
  PG_Rect PG_Application::my_mouse_position = PG_Rect(0,0,0,0);
  PG_CURSOR_MODE PG_Application::my_mouse_mode = PG_CURSOR_HARDWARE;
  PG_Font* PG_Application::DefaultFont = NULL;
! PG_Draw::PG_DrawableSurface* PG_Application::my_background;
! PG_Draw::PG_DrawableSurface* PG_Application::my_scaled_background;
  SDL_Color PG_Application::my_backcolor;
  int PG_Application::my_backmode;
***************
*** 68,71 ****
--- 68,72 ----
  std::vector<PG_MessageObject*> PG_Application::objectList;
  PG_Widget* PG_Application::lastwidget = NULL;
+ PG_Draw::PG_Draw* PG_Application::drawable = NULL;
  
  /**
***************
*** 107,115 ****
  
        /* Initialize the SDL library */
!       if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
                PG_LogERR("Could not initialize SDL: %s", SDL_GetError());
                exit(-1);
        }
        atexit(SDL_Quit);
        pGlobalApp = this;
        screen = NULL;
--- 108,123 ----
  
        /* Initialize the SDL library */
!       if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) {
                PG_LogERR("Could not initialize SDL: %s", SDL_GetError());
                exit(-1);
        }
        atexit(SDL_Quit);
+ 
+       /* drawable handles the videosystem init */
+         if (drawable == NULL) {
+               drawable = PG_Draw::PG_Draw::GetDefaultDrawable();
+       }
+       drawable->init(SDL_INIT_VIDEO);
+ 
        pGlobalApp = this;
        screen = NULL;
***************
*** 129,137 ****
  bool PG_Application::InitScreen(int w, int h, int depth, Uint32 flags) {
  
!       if(depth == 0) {
!               const SDL_VideoInfo* info = SDL_GetVideoInfo();
!               if ( info->vfmt->BitsPerPixel > 8 ) {
!                       depth = info->vfmt->BitsPerPixel;
!               }
        }
  
--- 137,142 ----
  bool PG_Application::InitScreen(int w, int h, int depth, Uint32 flags) {
  
!         if (drawable == NULL) {
!               drawable = PG_Draw::PG_Draw::GetDefaultDrawable();
        }
  
***************
*** 140,144 ****
  
        /* Initialize the display */
!       PG_Application::screen = SDL_SetVideoMode(w, h, depth, flags);
        if (PG_Application::screen == NULL) {
                PG_LogERR("Could not set video mode: %s", SDL_GetError());
--- 145,149 ----
  
        /* Initialize the display */
!       PG_Application::screen = drawable->SetMode(w, h, depth, flags);
        if (PG_Application::screen == NULL) {
                PG_LogERR("Could not set video mode: %s", SDL_GetError());
***************
*** 217,224 ****
        PG_Application::RedrawBackground(my_mouse_position);
  
!       SDL_SetClipRect(screen, &my_mouse_position);
        PG_RectList backlist = widgetList->Intersect(&my_mouse_position);
        backlist.Blit(my_mouse_position);
!       SDL_SetClipRect(screen, 0);
        return;
  }
--- 222,229 ----
        PG_Application::RedrawBackground(my_mouse_position);
  
!       drawable->SetClipRect(my_mouse_position);
        PG_RectList backlist = widgetList->Intersect(&my_mouse_position);
        backlist.Blit(my_mouse_position);
!       drawable->SetClipRect(PG_Rect());
        return;
  }
***************
*** 242,249 ****
        my_mouse_position.my_xpos = x;
        my_mouse_position.my_ypos = y;
!       SDL_BlitSurface(my_mouse_pointer, 0, screen, &my_mouse_position);
        if(!GetBulkMode() && bUpdate) {
!               SDL_UpdateRects(screen, 1, &saved);
!               SDL_UpdateRects(screen, 1, &my_mouse_position);
        }
  }
--- 247,255 ----
        my_mouse_position.my_xpos = x;
        my_mouse_position.my_ypos = y;
!       drawable->BlitSurface(my_mouse_pointer, PG_Rect(), my_mouse_position);
        if(!GetBulkMode() && bUpdate) {
!               drawable->UpdateRects(1, &saved);
!               drawable->UpdateRects(1, &my_mouse_position);
!               // drawable->Flip();
        }
  }
***************
*** 280,290 ****
                  return false;
          
!       screen = SDL_SetVideoMode(
                     event->w, event->h,
!                    screen->format->BitsPerPixel,
!                    screen->flags);
  
!       PG_Widget::UpdateRect(PG_Rect(0,0,event->w,event->h));
!       SDL_UpdateRect(screen,0,0,event->w,event->h);
        sigVideoResize(event);
  
--- 286,298 ----
                  return false;
          
!         screen->getScreen()->flags |= SDL_GLSDL;
!       screen = drawable->SetMode(
                     event->w, event->h,
!                    screen->getScreen()->format->BitsPerPixel,
!                    screen->getScreen()->flags);
  
!         PG_Rect r = PG_Rect(0,0,event->w,event->h);
!       PG_Widget::UpdateRect(r);
!       drawable->UpdateRects(1, &r);
        sigVideoResize(event);
  
***************
*** 292,296 ****
  }
  
! void PG_Application::SetCursor(SDL_Surface *image) {
        if(image == 0) {
                if(!my_mouse_pointer) {
--- 300,304 ----
  }
  
! void PG_Application::SetCursor(PG_Draw::PG_DrawableSurface *image) {
        if(image == 0) {
                if(!my_mouse_pointer) {
***************
*** 300,304 ****
                my_mouse_pointer = 0;
                ClearOldMousePosition();
!               SDL_UpdateRects(screen, 1, &my_mouse_position);
                SDL_ShowCursor(SDL_ENABLE);
                return;
--- 308,312 ----
                my_mouse_pointer = 0;
                ClearOldMousePosition();
!               drawable->UpdateRects(1, &my_mouse_position);
                SDL_ShowCursor(SDL_ENABLE);
                return;
***************
*** 310,314 ****
                my_mouse_pointer = image;
        }
!       image->refcount++;
        DrawCursor();
  }
--- 318,322 ----
                my_mouse_pointer = image;
        }
!       image->getScreen()->refcount++;
        DrawCursor();
  }
***************
*** 332,336 ****
        if(mode != PG_CURSOR_SOFTWARE && my_mouse_mode == PG_CURSOR_SOFTWARE) {
                ClearOldMousePosition();
!               SDL_UpdateRects(screen, 1, &my_mouse_position);
        }
        my_mouse_mode = mode;
--- 340,344 ----
        if(mode != PG_CURSOR_SOFTWARE && my_mouse_mode == PG_CURSOR_SOFTWARE) {
                ClearOldMousePosition();
!               drawable->UpdateRects(1, &my_mouse_position);
        }
        my_mouse_mode = mode;
***************
*** 340,356 ****
  
  /**  */
! SDL_Surface* PG_Application::SetScreen(SDL_Surface* surf) {
          if (!surf)
                  return PG_Application::screen;
          
!       PG_Application::screen = surf;
  
!       glMode = (surf->flags & SDL_OPENGLBLIT);
  
        SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 
SDL_DEFAULT_REPEAT_INTERVAL);
        SDL_EnableUNICODE(true);
  
!       PG_Widget::UpdateRect(PG_Rect(0,0,screen->w,screen->h));
!       SDL_UpdateRect(screen, 0,0,screen->w,screen->h);
  
        return PG_Application::screen;
--- 348,365 ----
  
  /**  */
! PG_Draw::PG_DrawableSurface* 
PG_Application::SetScreen(PG_Draw::PG_DrawableSurface* surf) {
          if (!surf)
                  return PG_Application::screen;
          
!         PG_Application::screen = surf; // new 
PG_Draw::PG_DrawableSurface(surf);
  
!       glMode = (surf->getScreen()->flags & SDL_OPENGLBLIT);
  
        SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 
SDL_DEFAULT_REPEAT_INTERVAL);
        SDL_EnableUNICODE(true);
  
!         PG_Rect r = 
PG_Rect(0,0,screen->getScreen()->w,screen->getScreen()->h);
!       PG_Widget::UpdateRect(r);
!       drawable->UpdateRects(1, &r);
  
        return PG_Application::screen;
***************
*** 366,370 ****
        if(my_scaled_background) {
                // Destroyed scaled background if present
!               SDL_FreeSurface(my_scaled_background);
                my_scaled_background = 0;
        }               
--- 375,379 ----
        if(my_scaled_background) {
                // Destroyed scaled background if present
!               delete my_scaled_background; // 
SDL_FreeSurface(my_scaled_background);
                my_scaled_background = 0;
        }               
***************
*** 372,376 ****
                my_freeBackground = true;
                my_backmode = mode;
!               RedrawBackground(PG_Rect(0,0,screen->w,screen->h));
                return true;
        } else {
--- 381,385 ----
                my_freeBackground = true;
                my_backmode = mode;
!               
RedrawBackground(PG_Rect(0,0,screen->getScreen()->w,screen->getScreen()->h));
                return true;
        } else {
***************
*** 382,386 ****
  
  /**  */
! bool PG_Application::SetBackground(SDL_Surface* surface, int mode) {
        if(surface == NULL)
                return false;
--- 391,395 ----
  
  /**  */
! bool PG_Application::SetBackground(PG_Draw::PG_DrawableSurface* surface, int 
mode) {
        if(surface == NULL)
                return false;
***************
*** 388,392 ****
        if(my_scaled_background) {
                // Destroyed scaled background if present
!               SDL_FreeSurface(my_scaled_background);
                my_scaled_background = 0;
        }
--- 397,401 ----
        if(my_scaled_background) {
                // Destroyed scaled background if present
!               delete my_scaled_background; // 
SDL_FreeSurface(my_scaled_background);
                my_scaled_background = 0;
        }
***************
*** 399,403 ****
        my_backmode = mode;
  
!       RedrawBackground(PG_Rect(0,0,screen->w,screen->h));
        return true;
  }
--- 408,412 ----
        my_backmode = mode;
  
!       
RedrawBackground(PG_Rect(0,0,screen->getScreen()->w,screen->getScreen()->h));
        return true;
  }
***************
*** 405,409 ****
  /**  */
  void PG_Application::RedrawBackground(const PG_Rect& rect) {
!       static PG_Rect screenrect(0,0,screen->w,screen->h);
  
        if(GetBulkMode() || !enableBackground) {
--- 414,418 ----
  /**  */
  void PG_Application::RedrawBackground(const PG_Rect& rect) {
!       static PG_Rect 
screenrect(0,0,screen->getScreen()->w,screen->getScreen()->h);
  
        if(GetBulkMode() || !enableBackground) {
***************
*** 416,444 ****
        if(!my_background) {
                SDL_Color c = my_backcolor;
!               SDL_FillRect(screen, (SDL_Rect*)&fillrect, 
SDL_MapRGB(screen->format, c.r, c.g, c.b));
                PG_Application::UnlockScreen();
                return;
        }
        if(my_backmode == BKMODE_STRETCH &&
!          (my_background->w != screen->w ||
!           my_background->h != screen->h)) {
                if(my_scaled_background && 
!                  (my_scaled_background->w != screen->w ||
!                   my_scaled_background->h != screen->h)) {
!                       SDL_FreeSurface(my_scaled_background); // size mismatch
                        my_scaled_background = 0;
                }
                if(!my_scaled_background) {
                        my_scaled_background =
!                               PG_Draw::ScaleSurface(my_background,
!                                                     
static_cast<Uint16>(screen->w), static_cast<Uint16>(screen->h));
                }
!               SDL_GetClipRect(screen, (SDL_Rect*)&fillrect);
!               SDL_SetClipRect(screen, (SDL_Rect*)&rect);
!               SDL_BlitSurface(my_scaled_background, 0, screen, 0);
!               SDL_SetClipRect(screen, (SDL_Rect*)&fillrect);
  
        } else {
!               PG_Draw::DrawTile(screen, screenrect, rect, my_background);
        }
        
--- 425,452 ----
        if(!my_background) {
                SDL_Color c = my_backcolor;
!               screen->FillRect(fillrect, 
SDL_MapRGB(screen->getScreen()->format, c.r, c.g, c.b));
                PG_Application::UnlockScreen();
                return;
        }
        if(my_backmode == BKMODE_STRETCH &&
!          (my_background->getScreen()->w != screen->getScreen()->w ||
!           my_background->getScreen()->h != screen->getScreen()->h)) {
                if(my_scaled_background && 
!                  (my_scaled_background->getScreen()->w != 
screen->getScreen()->w ||
!                   my_scaled_background->getScreen()->h != 
screen->getScreen()->h)) {
!                       delete my_scaled_background; // 
SDL_FreeSurface(my_scaled_background); // size mismatch
                        my_scaled_background = 0;
                }
                if(!my_scaled_background) {
                        my_scaled_background =
!                               
my_background->ScaleSurface(static_cast<Uint16>(screen->getScreen()->w), 
static_cast<Uint16>(screen->getScreen()->h));
                }
!               drawable->GetClipRect(fillrect);
!               drawable->SetClipRect(rect);
!               drawable->BlitSurface(my_scaled_background, PG_Rect(), 
PG_Rect());
!               drawable->SetClipRect(fillrect);
  
        } else {
!               screen->DrawTile(screenrect, rect, my_background);
        }
        
***************
*** 468,472 ****
  
  void PG_Application::FlipPage() {
!       SDL_Flip(screen);
  }
  
--- 476,480 ----
  
  void PG_Application::FlipPage() {
!       drawable->Flip();
  }
  
***************
*** 478,482 ****
        SDL_Rect **modes;
  
!       info = SDL_GetVideoInfo();
        PG_LogDBG("Current display: %d bits-per-pixel", 
info->vfmt->BitsPerPixel);
  
--- 486,490 ----
        SDL_Rect **modes;
  
!       info = drawable->GetVideoInfo();
        PG_LogDBG("Current display: %d bits-per-pixel", 
info->vfmt->BitsPerPixel);
  
***************
*** 488,492 ****
        }
        /* Print available fullscreen video modes */
!       modes = SDL_ListModes(NULL, SDL_FULLSCREEN);
        if ( modes == (SDL_Rect **)0 ) {
                PG_LogDBG("No available fullscreen video modes");
--- 496,500 ----
        }
        /* Print available fullscreen video modes */
!       modes = drawable->ListModes(NULL, SDL_FULLSCREEN);
        if ( modes == (SDL_Rect **)0 ) {
                PG_LogDBG("No available fullscreen video modes");
***************
*** 604,608 ****
                if(my_scaled_background) {
                        // Destroyed scaled background if present
!                       SDL_FreeSurface(my_scaled_background);
                        my_scaled_background = 0;
                }               
--- 612,616 ----
                if(my_scaled_background) {
                        // Destroyed scaled background if present
!                       delete my_scaled_background; // 
SDL_FreeSurface(my_scaled_background);
                        my_scaled_background = 0;
                }               
***************
*** 647,651 ****
        if(my_scaled_background) {
                // Destroyed scaled background if present
!               SDL_FreeSurface(my_scaled_background);
                my_scaled_background = 0;
        }
--- 655,659 ----
        if(my_scaled_background) {
                // Destroyed scaled background if present
!               delete my_scaled_background; // 
SDL_FreeSurface(my_scaled_background);
                my_scaled_background = 0;
        }
***************
*** 686,690 ****
  
  void PG_Application::SetIcon(const char *filename) {
!       SDL_Surface* icon;
        Uint8* pixels;
        Uint8* mask;
--- 694,698 ----
  
  void PG_Application::SetIcon(const char *filename) {
!       PG_Draw::PG_DrawableSurface* icon;
        Uint8* pixels;
        Uint8* mask;
***************
*** 699,703 ****
  
        // Check width and height
!       if ( (icon->w%8) != 0 ) {
                PG_LogWRN("Icon width must be a multiple of 8!");
                UnloadSurface(icon);
--- 707,711 ----
  
        // Check width and height
!       if ( (icon->getScreen()->w%8) != 0 ) {
                PG_LogWRN("Icon width must be a multiple of 8!");
                UnloadSurface(icon);
***************
*** 706,710 ****
  
        //Check the palette
!       if ( icon->format->palette == NULL ) {
                PG_LogWRN("Icon must have a palette!");
                UnloadSurface(icon);
--- 714,718 ----
  
        //Check the palette
!       if ( icon->getScreen()->format->palette == NULL ) {
                PG_LogWRN("Icon must have a palette!");
                UnloadSurface(icon);
***************
*** 713,721 ****
  
        // Set the colorkey
!       SDL_SetColorKey(icon, SDL_SRCCOLORKEY, *((Uint8 *)icon->pixels));
  
        // Create the mask
!       pixels = (Uint8 *)icon->pixels;
!       mlen = icon->w*icon->h;
        mask =  new Uint8[mlen/8];
  
--- 721,729 ----
  
        // Set the colorkey
!       icon->SetColorKey(SDL_SRCCOLORKEY, *((Uint8 
*)icon->getScreen()->pixels));
  
        // Create the mask
!       pixels = (Uint8 *)icon->getScreen()->pixels;
!       mlen = icon->getScreen()->w*icon->getScreen()->h;
        mask =  new Uint8[mlen/8];
  
***************
*** 740,744 ****
        //Set icon
        if ( icon != NULL ) {
!               SDL_WM_SetIcon(icon, mask);
        }
  
--- 748,752 ----
        //Set icon
        if ( icon != NULL ) {
!               SDL_WM_SetIcon(icon->getScreen(), mask);
        }
  
***************
*** 890,903 ****
  }
  
! SDL_Surface* PG_Application::GetScreen() {
        return screen;
  }
  
  int PG_Application::GetScreenHeight() {
!       return screen->h;
  }
  
  int PG_Application::GetScreenWidth() {
!       return screen->w;
  }
  
--- 898,911 ----
  }
  
! PG_Draw::PG_DrawableSurface* PG_Application::GetScreen() {
        return screen;
  }
  
  int PG_Application::GetScreenHeight() {
!       return screen->getScreen()->h;
  }
  
  int PG_Application::GetScreenWidth() {
!       return screen->getScreen()->w;
  }
  
***************
*** 1196,1199 ****
--- 1204,1222 ----
                }
        }
+ }
+ 
+ void PG_Application::SetDrawingEnvironment(PG_Draw::PG_Draw* d) {
+         if (d == NULL) {
+          if (drawable == NULL) {
+             d = PG_Draw::PG_Draw::GetDefaultDrawable();
+          } else {
+             return;
+          }
+       }
+         drawable = d;
+ }
+    
+ PG_Draw::PG_Draw* PG_Application::GetDrawingEnvironment() {
+         return drawable;
  }
  

Index: pgfilearchive.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgfilearchive.cpp,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -r1.4 -r1.4.2.1
*** pgfilearchive.cpp   29 Apr 2002 11:44:22 -0000      1.4
--- pgfilearchive.cpp   18 Jun 2002 22:40:38 -0000      1.4.2.1
***************
*** 33,36 ****
--- 33,37 ----
  #include "pgfont.h"
  #include "physfsrwops.h"
+ #include "pgdraw.h"
  
  #ifdef HAVE_SDLIMAGE
***************
*** 217,221 ****
  }
  
! SDL_Surface* PG_FileArchive::LoadSurface(const char* filename, bool convert) {
        if(filename == NULL) {
                return NULL;
--- 218,223 ----
  }
  
! PG_Draw::PG_DrawableSurface* PG_FileArchive::LoadSurface(const char* 
filename, bool convert) {
!       PG_Draw::PG_Draw* draw = PG_Draw::PG_Draw::GetDefaultDrawable();
        if(filename == NULL) {
                return NULL;
***************
*** 229,233 ****
  
        // take a look into the cache
!       SDL_Surface* surface = my_cache.FindSurface(fn);
  
        // return the cache surface if it has been found
--- 231,235 ----
  
        // take a look into the cache
!       PG_Draw::PG_DrawableSurface* surface = my_cache.FindSurface(fn);
  
        // return the cache surface if it has been found
***************
*** 240,253 ****
        SDL_RWops *rw = PHYSFSRWOPS_openRead(filename);
        
  #ifdef HAVE_SDLIMAGE
!       surface = IMG_Load_RW(rw, 1);
  #else
!       surface = SDL_LoadBMP_RW(rw, 1);
  #endif
        
        if(convert) {
!               SDL_Surface* tmpsrf = SDL_DisplayFormat(surface);
                if(tmpsrf) {
!                       SDL_FreeSurface(surface);
                        surface = tmpsrf;
                }
--- 242,260 ----
        SDL_RWops *rw = PHYSFSRWOPS_openRead(filename);
        
+       {
+               SDL_Surface* t;
  #ifdef HAVE_SDLIMAGE
!               t = IMG_Load_RW(rw, 1);
  #else
!               t = SDL_LoadBMP_RW(rw, 1);
  #endif
+               surface = new PG_Draw::PG_DrawableSurface(t);
+       };
        
        if(convert) {
!               PG_Draw::PG_DrawableSurface* tmpsrf =
!                       draw->AccelDrawableSurface(surface->getScreen());
                if(tmpsrf) {
!                       delete surface; // SDL_FreeSurface(surface);
                        surface = tmpsrf;
                }
***************
*** 261,265 ****
  }
  
! bool PG_FileArchive::UnloadSurface(SDL_Surface* surface, bool 
bDeleteIfNotExists) {
        my_cache.DeleteSurface(surface, bDeleteIfNotExists);
        return true;
--- 268,272 ----
  }
  
! bool PG_FileArchive::UnloadSurface(PG_Draw::PG_DrawableSurface* surface, bool 
bDeleteIfNotExists) {
        my_cache.DeleteSurface(surface, bDeleteIfNotExists);
        return true;

Index: pgrectlist.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgrectlist.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -r1.2 -r1.2.2.1
*** pgrectlist.cpp      29 Apr 2002 11:44:22 -0000      1.2
--- pgrectlist.cpp      18 Jun 2002 22:40:38 -0000      1.2.2.1
***************
*** 31,34 ****
--- 31,35 ----
  #include "pgapplication.h"
  #include "pglog.h"
+ #include "pgdraw.h"
  
  #include <algorithm>
***************
*** 151,159 ****
  void PG_RectList::Blit(const PG_Rect& rect) {
        PG_RectList* childs;
!       static SDL_Surface* screen = PG_Application::GetScreen();
  
        // store old clipping rectangle
        PG_Rect o;
!       SDL_GetClipRect(screen, &o);
  
        // blit all objects in the list
--- 152,160 ----
  void PG_RectList::Blit(const PG_Rect& rect) {
        PG_RectList* childs;
!       static PG_Draw::PG_DrawableSurface* screen = 
PG_Application::GetScreen();
  
        // store old clipping rectangle
        PG_Rect o;
!       screen->GetClipRect(o);
  
        // blit all objects in the list
***************
*** 168,172 ****
                PG_Rect* cr = (*i)->GetClipRect();
                PG_Rect c = cr->IntersectRect(rect);
!               SDL_SetClipRect(screen, &c);
  
                // blit it
--- 169,173 ----
                PG_Rect* cr = (*i)->GetClipRect();
                PG_Rect c = cr->IntersectRect(rect);
!               screen->SetClipRect(c);
  
                // blit it
***************
*** 181,185 ****
  
        // reset clipping rectangle
!       SDL_SetClipRect(PG_Application::GetScreen(), &o);
  }
  
--- 182,186 ----
  
        // reset clipping rectangle
!       PG_Application::GetScreen()->SetClipRect(o);
  }
  

Index: pgsurfacecache.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgsurfacecache.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -r1.2 -r1.2.2.1
*** pgsurfacecache.cpp  26 Apr 2002 12:43:22 -0000      1.2
--- pgsurfacecache.cpp  18 Jun 2002 22:40:38 -0000      1.2.2.1
***************
*** 30,33 ****
--- 30,34 ----
  #include "pgsurfacecache.h"
  #include "pglog.h"
+ #include "pgdraw.h"
  #include <iostream>
  #include <cstring>
***************
*** 98,102 ****
                pg_surface_cache_t* t = (*i).second;
                if(t != NULL) {
!                       SDL_FreeSurface(t->surface);
                        delete t;
                }
--- 99,103 ----
                pg_surface_cache_t* t = (*i).second;
                if(t != NULL) {
!                       delete t->surface; // SDL_FreeSurface(t->surface);
                        delete t;
                }
***************
*** 110,114 ****
  
  void PG_SurfaceCache::CreateKey(std::string &key, Uint16 w, Uint16 h,
!                                 PG_Gradient* gradient, SDL_Surface* 
background,
                                  Sint8 bkmode, Uint8 blend) {
        char tmpkey[256];
--- 111,115 ----
  
  void PG_SurfaceCache::CreateKey(std::string &key, Uint16 w, Uint16 h,
!                                 PG_Gradient* gradient, 
PG_Draw::PG_DrawableSurface* background,
                                  Sint8 bkmode, Uint8 blend) {
        char tmpkey[256];
***************
*** 172,180 ****
  }
  
! pg_surface_cache_t* PG_SurfaceCache::FindBySurface(SDL_Surface* surface) {
        return (*MY_SURFACEINDEX)[reinterpret_cast<unsigned long>(surface)];
  }
  
! SDL_Surface* PG_SurfaceCache::FindSurface(const std::string &key) {
        pg_surface_cache_t* t = (*MY_SURFACEMAP)[key];
  
--- 173,181 ----
  }
  
! pg_surface_cache_t* 
PG_SurfaceCache::FindBySurface(PG_Draw::PG_DrawableSurface* surface) {
        return (*MY_SURFACEINDEX)[reinterpret_cast<unsigned long>(surface)];
  }
  
! PG_Draw::PG_DrawableSurface* PG_SurfaceCache::FindSurface(const std::string 
&key) {
        pg_surface_cache_t* t = (*MY_SURFACEMAP)[key];
  
***************
*** 186,190 ****
  }
  
! SDL_Surface* PG_SurfaceCache::AddSurface(const std::string &key, SDL_Surface* 
surface) {
        pg_surface_cache_t* t = NULL;
  
--- 187,191 ----
  }
  
! PG_Draw::PG_DrawableSurface* PG_SurfaceCache::AddSurface(const std::string 
&key, PG_Draw::PG_DrawableSurface* surface) {
        pg_surface_cache_t* t = NULL;
  
***************
*** 200,204 ****
                }
  
!               SDL_FreeSurface(surface);
                t->refcount++;
                return t->surface;
--- 201,205 ----
                }
  
!               delete surface; // SDL_FreeSurface(surface);
                t->refcount++;
                return t->surface;
***************
*** 215,219 ****
  }
  
! void PG_SurfaceCache::DeleteSurface(SDL_Surface* surface, bool 
bDeleteIfNotExists) {
  
        if(!surface) {
--- 216,220 ----
  }
  
! void PG_SurfaceCache::DeleteSurface(PG_Draw::PG_DrawableSurface* surface, 
bool bDeleteIfNotExists) {
  
        if(!surface) {
***************
*** 226,230 ****
        if(t == NULL) {
                if(bDeleteIfNotExists) {
!                       SDL_FreeSurface(surface);
                }
                return;
--- 227,231 ----
        if(t == NULL) {
                if(bDeleteIfNotExists) {
!                       delete surface; // SDL_FreeSurface(surface);
                }
                return;
***************
*** 242,246 ****
        MY_SURFACEINDEX->erase(reinterpret_cast<unsigned long>(surface));
  
!       SDL_FreeSurface(t->surface);
        delete t;
  }
--- 243,247 ----
        MY_SURFACEINDEX->erase(reinterpret_cast<unsigned long>(surface));
  
!       delete t->surface; // SDL_FreeSurface(t->surface);
        delete t;
  }

Index: physfsrwops.h
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/physfsrwops.h,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -r1.1 -r1.1.4.1
*** physfsrwops.h       27 Apr 2002 16:06:25 -0000      1.1
--- physfsrwops.h       18 Jun 2002 22:40:38 -0000      1.1.4.1
***************
*** 24,28 ****
  
  #include "physfs.h"
! #include "SDL.h"
  
  #ifdef __cplusplus
--- 24,29 ----
  
  #include "physfs.h"
! // #include "SDL.h"
! #include "glSDL.h"
  
  #ifdef __cplusplus




reply via email to

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