]> git.saurik.com Git - wxWidgets.git/commitdiff
Corrected wxImage for use with mono wxBitmaps,
authorRobert Roebling <robert@roebling.de>
Mon, 18 Oct 1999 08:51:23 +0000 (08:51 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 18 Oct 1999 08:51:23 +0000 (08:51 +0000)
  Corrected compilation of wxApp without threads (untested).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4044 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/app.h
include/wx/gtk1/app.h
samples/image/Makefile.in
src/common/image.cpp

index 58083583f8ea141b041eeeaf5c72812e3ae2d493..80f57acf6491a4406c9e5ba0fa16ddf4f2c939f2 100644 (file)
@@ -59,9 +59,7 @@ public:
     static void CleanUp();
 
     bool ProcessIdle();
-#if wxUSE_THREADS
     void ProcessPendingEvents();
-#endif
     void DeletePendingObjects();
 
     // This can be used to suppress the generation of Idle events.
index 58083583f8ea141b041eeeaf5c72812e3ae2d493..80f57acf6491a4406c9e5ba0fa16ddf4f2c939f2 100644 (file)
@@ -59,9 +59,7 @@ public:
     static void CleanUp();
 
     bool ProcessIdle();
-#if wxUSE_THREADS
     void ProcessPendingEvents();
-#endif
     void DeletePendingObjects();
 
     // This can be used to suppress the generation of Idle events.
index 0e42ca259ccc5e5c0f1dc694709b4eed075f27fa..0e1f7e8b74568034102feb27f3358d3e904d3b2a 100644 (file)
@@ -13,7 +13,7 @@ top_srcdir = @top_srcdir@
 top_builddir = ../..
 program_dir = samples/image
 
-DATAFILES = horse.png horse.jpg horse.bmp horse.gif horse.pcx
+DATAFILES = horse.png horse.jpg horse.bmp horse.gif horse.pcx horse.pnm
 
 PROGRAM=image
 
index ca479f93f10629f51d53630b729ba69f6ad4fd89..3679c78d0377ece78988b8a3e4a9be95072ca5b2 100644 (file)
@@ -1238,9 +1238,22 @@ wxImage::wxImage( const wxBitmap &bitmap )
 {
     wxCHECK_RET( bitmap.Ok(), wxT("invalid bitmap") );
 
-    GdkImage *gdk_image = gdk_image_get( bitmap.GetPixmap(),
-        0, 0,
-        bitmap.GetWidth(), bitmap.GetHeight() );
+    GdkImage *gdk_image = (GdkImage*) NULL;
+    if (bitmap.GetPixmap())
+    {
+        gdk_image = gdk_image_get( bitmap.GetPixmap(),
+            0, 0,
+            bitmap.GetWidth(), bitmap.GetHeight() );
+    } else
+    if (bitmap.GetBitmap())
+    {
+        gdk_image = gdk_image_get( bitmap.GetBitmap(),
+            0, 0,
+            bitmap.GetWidth(), bitmap.GetHeight() );
+    } else
+    {
+        wxFAIL_MSG( wxT("Ill-formed bitmap") );
+    }
 
     wxCHECK_RET( gdk_image, wxT("couldn't create image") );
 
@@ -1264,7 +1277,12 @@ wxImage::wxImage( const wxBitmap &bitmap )
         SetMaskColour( 16, 16, 16 );  // anything unlikely and dividable
     }
 
-    GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
+    GdkVisual *visual = (GdkVisual*) NULL;
+    if (bitmap.GetPixmap())
+        visual = gdk_window_get_visual( bitmap.GetPixmap() );
+    else
+        visual = gdk_window_get_visual( bitmap.GetBitmap() );
+
     if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
     int bpp = visual->depth;
     if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15;
@@ -1277,7 +1295,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
         for (int i = 0; i < bitmap.GetWidth(); i++)
         {
             wxInt32 pixel = gdk_image_get_pixel( gdk_image, i, j );
-            pixel = wxINT32_SWAP_ON_BE( pixel );
+            // pixel = wxINT32_SWAP_ON_BE( pixel );
             if (bpp <= 8)
             {
                 data[pos] = cmap->colors[pixel].red >> 8;