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.7,1.1.2.8 drawable.cp


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/draw draw.cpp,1.1.2.7,1.1.2.8 drawable.cpp,1.1.2.5,1.1.2.6 drawtile.cpp,1.3.2.4,1.3.2.5
Date: Thu, 24 Oct 2002 12:08:15 -0400

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

Modified Files:
      Tag: devel-opengl
        draw.cpp drawable.cpp drawtile.cpp 
Log Message:
A number of updates - please review.  Probably will remove some of these 
features.  Almost solved the OpenGL driver problems....


Index: draw.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/Attic/draw.cpp,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -r1.1.2.7 -r1.1.2.8
*** draw.cpp    7 Oct 2002 22:23:26 -0000       1.1.2.7
--- draw.cpp    24 Oct 2002 16:08:13 -0000      1.1.2.8
***************
*** 34,40 ****
--- 34,85 ----
  #include "pglog.h"
  #include "drawpriv.hh"
+ #include <errno.h>
  
  PG_Draw::PG_Draw* PG_Draw::PG_Draw::defaultdraw = NULL;
  
+ int PG_Draw::PG_Draw::attach(PG_DrawableSurface* s) {
+   // fprintf(stderr, "%s:%s:%i flags %x\n", __FILE__, __FUNCTION__, __LINE__, 
flags);
+   if (s == NULL) return -EINVAL;
+   s->creator = this;
+   surflist.push_back(s);
+   // PG_LogMSG("attach to creator %s", s->getCreator()->getName().c_str());
+   return 0;
+ };
+ 
+ int PG_Draw::PG_Draw::detach(PG_DrawableSurface* s) {
+   surfiter p;
+   bool found=false;
+   for (p=surflist.begin(); p!=surflist.end(); p++) {
+     if (*p == s) {
+       /* found it! */
+       found=true;
+       break;
+     };
+   };
+   if (found) {
+     surflist.erase(p);
+     return 0;
+   };
+   return -ENOENT;
+ };
+ 
+ PG_Draw::PG_DrawableSurface* PG_Draw::PG_Draw::MakeNative(PG_DrawableSurface* 
s) {
+   /* as SDL compatibility is required of surfaces just leave it alone...
+    * for now...  SHOULD take surface and blit onto new surface
+    * FIXME
+    */
+   attach(s);
+   return s;
+ };
+ 
+ bool PG_Draw::PG_Draw::ConvertAllNative(PG_Draw* drew) {
+   surfiter p;
+   if (drew == NULL) return false;
+   for (p=drew->surflist.begin(); p!=drew->surflist.end(); p++) {
+     MakeNative(*p);
+   };
+   return true;
+ };
+ 
  PG_Draw::PG_Draw::PG_Draw* PG_Draw::PG_Draw::GetDefaultDrawable() {
    if (defaultdraw == NULL) {
***************
*** 60,64 ****
  };
  
! PG_Draw::PG_Draw::PG_Draw() {
  #if 0 /* fixme this should probably move here */
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
--- 105,109 ----
  };
  
! PG_Draw::PG_Draw::PG_Draw() : surflist() {
  #if 0 /* fixme this should probably move here */
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
***************
*** 145,148 ****
--- 190,194 ----
    /* dumpflags(t->flags); */
    surf = new PG_DrawableSurface(t);
+   attach(surf);
    screen = surf;
    if (screen == NULL) { PG_LogERR("failed to create window"); exit(-1); }
***************
*** 195,198 ****
--- 241,254 ----
  
  PG_Draw::PG_DrawableSurface*
+ PG_Draw::PG_Draw::CreateSDLSurface(SDL_Surface* s) {
+   PG_DrawableSurface* surf;
+   if (s == NULL) { PG_LogERR("invalid SDL surface!"); return NULL; }
+   surf = new PG_DrawableSurface(s);
+   attach(surf);
+   if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
+   return surf;
+ };
+ 
+ PG_Draw::PG_DrawableSurface*
  PG_Draw::PG_Draw::CreateDrawableSurface(Uint32 flags,
                               int width, int height, int depth=0,
***************
*** 220,223 ****
--- 276,280 ----
    // fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
    surf = new PG_DrawableSurface(t);
+   attach(surf);
    if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
    // fprintf(stderr, "%s:%s:%i %i,%i\n", __FILE__, __FUNCTION__, __LINE__, 
width, height);
***************
*** 237,240 ****
--- 294,298 ----
    // fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
    surf = new PG_DrawableSurface(t);
+   attach(surf);
    if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
    // fprintf(stderr, "%s:%s:%i %i,%i %p:%p\n", __FILE__, __FUNCTION__, 
__LINE__, width, height, surf, q);
***************
*** 280,283 ****
--- 338,342 ----
    // fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
    surf = new PG_DrawableSurface(t);
+   attach(surf);
    if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
    // fprintf(stderr, "%s:%s:%i %i,%i\n", __FILE__, __FUNCTION__, __LINE__, 
width, height);
***************
*** 292,295 ****
--- 351,355 ----
    fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
    surf = new PG_DrawableSurface(t);
+   attach(surf);
    if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
    fprintf(stderr, "%s:%s:%i %i,%i\n", __FILE__, __FUNCTION__, __LINE__, 
src->w, src->h);
***************
*** 308,311 ****
--- 368,372 ----
    fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
    surf = new PG_DrawableSurface(t);
+   attach(surf);
    if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
    fprintf(stderr, "%s:%s:%i %i,%i\n", __FILE__, __FUNCTION__, __LINE__, 
src->w, src->h);
***************
*** 323,326 ****
--- 384,388 ----
    fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
    surf = new PG_DrawableSurface(t);
+   attach(surf);
    if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
    fprintf(stderr, "%s:%s:%i %i,%i\n", __FILE__, __FUNCTION__, __LINE__, r.w, 
r.h);
***************
*** 339,342 ****
--- 401,405 ----
    fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
    surf = new PG_DrawableSurface(t);
+   attach(surf);
    if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
    fprintf(stderr, "%s:%s:%i %i,%i\n", __FILE__, __FUNCTION__, __LINE__, r.w, 
r.h);

Index: drawable.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/Attic/drawable.cpp,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -r1.1.2.5 -r1.1.2.6
*** drawable.cpp        7 Oct 2002 22:23:26 -0000       1.1.2.5
--- drawable.cpp        24 Oct 2002 16:08:13 -0000      1.1.2.6
***************
*** 118,122 ****
                                              const PG_Rect& rect_src,
                                              const PG_Rect& rect_dst) {
!   // fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__);
    BlitSurface(srf_src->ref, rect_src, rect_dst);
  };
--- 118,132 ----
                                              const PG_Rect& rect_src,
                                              const PG_Rect& rect_dst) {
!   /* fprintf(stderr, "%s:%s:%i\n", __FILE__, __FUNCTION__, __LINE__); */
! #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!");
!     return;
!   };
    BlitSurface(srf_src->ref, rect_src, rect_dst);
  };

Index: drawtile.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/drawtile.cpp,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -C2 -r1.3.2.4 -r1.3.2.5
*** drawtile.cpp        10 Oct 2002 19:16:20 -0000      1.3.2.4
--- drawtile.cpp        24 Oct 2002 16:08:13 -0000      1.3.2.5
***************
*** 65,69 ****
    PG_Rect src(0,0, tilemap->ref->w, tilemap->ref->h);
    PG_Rect dst = src;
!   
    for(int y = index1.y; y < index2.y; y++) {
      for(int x = index1.x; x < index2.x; x++) {
--- 65,75 ----
    PG_Rect src(0,0, tilemap->ref->w, tilemap->ref->h);
    PG_Rect dst = src;
! 
! #if 0   /* FIXME debug code doesn't work here */
!   DBG5(DBGLINE());
!   PG_LogMSG("dst creator %s", creator->getName().c_str());
!   PG_LogMSG("src creator %s", tilemap->getCreator()->getName().c_str());
! #endif
! 
    for(int y = index1.y; y < index2.y; y++) {
      for(int x = index1.x; x < index2.x; x++) {





reply via email to

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