set depth to 32 when creating pixbuf from wxImage with alpha; correct a few comments
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40812 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -84,7 +84,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
|
|||||||
// one bit per pixel, each row starts on a byte boundary
|
// one bit per pixel, each row starts on a byte boundary
|
||||||
const size_t out_size = size_t((w + 7) / 8) * unsigned(h);
|
const size_t out_size = size_t((w + 7) / 8) * unsigned(h);
|
||||||
wxByte* out = new wxByte[out_size];
|
wxByte* out = new wxByte[out_size];
|
||||||
// set bits are white
|
// set bits are unmasked
|
||||||
memset(out, 0xff, out_size);
|
memset(out, 0xff, out_size);
|
||||||
unsigned bit_index = 0;
|
unsigned bit_index = 0;
|
||||||
if (bitmap.HasPixbuf())
|
if (bitmap.HasPixbuf())
|
||||||
@@ -496,7 +496,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& image, int depth)
|
|||||||
// one bit per pixel, each row starts on a byte boundary
|
// one bit per pixel, each row starts on a byte boundary
|
||||||
const size_t out_size = size_t((w + 7) / 8) * unsigned(h);
|
const size_t out_size = size_t((w + 7) / 8) * unsigned(h);
|
||||||
wxByte* out = new wxByte[out_size];
|
wxByte* out = new wxByte[out_size];
|
||||||
// set bits are white
|
// set bits are black
|
||||||
memset(out, 0xff, out_size);
|
memset(out, 0xff, out_size);
|
||||||
const wxByte* in = image.GetData();
|
const wxByte* in = image.GetData();
|
||||||
unsigned bit_index = 0;
|
unsigned bit_index = 0;
|
||||||
@@ -580,7 +580,7 @@ bool wxBitmap::CreateFromImageAsPixbuf(const wxImage& image)
|
|||||||
wxASSERT( gdk_pixbuf_get_width(pixbuf) == width );
|
wxASSERT( gdk_pixbuf_get_width(pixbuf) == width );
|
||||||
wxASSERT( gdk_pixbuf_get_height(pixbuf) == height );
|
wxASSERT( gdk_pixbuf_get_height(pixbuf) == height );
|
||||||
|
|
||||||
SetDepth(wxTheApp->GetGdkVisual()->depth);
|
SetDepth(32);
|
||||||
SetPixbuf(pixbuf);
|
SetPixbuf(pixbuf);
|
||||||
|
|
||||||
// Copy the data:
|
// Copy the data:
|
||||||
@@ -646,7 +646,7 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
GdkPixmap* pixmap_invert = NULL;
|
GdkPixmap* pixmap_invert = NULL;
|
||||||
if (GetDepth() == 1)
|
if (GetDepth() == 1)
|
||||||
{
|
{
|
||||||
// mono bitmaps are inverted
|
// mono bitmaps are inverted, i.e. 0 is white
|
||||||
pixmap_invert = gdk_pixmap_new(pixmap, w, h, 1);
|
pixmap_invert = gdk_pixmap_new(pixmap, w, h, 1);
|
||||||
GdkGC* gc = gdk_gc_new(pixmap_invert);
|
GdkGC* gc = gdk_gc_new(pixmap_invert);
|
||||||
gdk_gc_set_function(gc, GDK_COPY_INVERT);
|
gdk_gc_set_function(gc, GDK_COPY_INVERT);
|
||||||
|
Reference in New Issue
Block a user