diff options
Diffstat (limited to 'src/libui_sdl/libui')
-rw-r--r-- | src/libui_sdl/libui/ui.h | 2 | ||||
-rw-r--r-- | src/libui_sdl/libui/unix/draw.c | 4 | ||||
-rw-r--r-- | src/libui_sdl/libui/windows/draw.cpp | 5 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/libui_sdl/libui/ui.h b/src/libui_sdl/libui/ui.h index 47da54b..e15c127 100644 --- a/src/libui_sdl/libui/ui.h +++ b/src/libui_sdl/libui/ui.h @@ -516,7 +516,7 @@ _UI_EXTERN void uiDrawSave(uiDrawContext *c); _UI_EXTERN void uiDrawRestore(uiDrawContext *c); // bitmap API -_UI_EXTERN uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height); +_UI_EXTERN uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height, int alpha); _UI_EXTERN void uiDrawBitmapUpdate(uiDrawBitmap* bmp, const void* data); _UI_EXTERN void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRect* dstrect, int filter); _UI_EXTERN void uiDrawFreeBitmap(uiDrawBitmap* bmp); diff --git a/src/libui_sdl/libui/unix/draw.c b/src/libui_sdl/libui/unix/draw.c index e55397e..5befcd3 100644 --- a/src/libui_sdl/libui/unix/draw.c +++ b/src/libui_sdl/libui/unix/draw.c @@ -143,13 +143,13 @@ void uiDrawRestore(uiDrawContext *c) // bitmap API -uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height) +uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height, int alpha) { uiDrawBitmap* bmp; bmp = uiNew(uiDrawBitmap); - bmp->bmp = cairo_image_surface_create(CAIRO_FORMAT_RGB24, width, height); + bmp->bmp = cairo_image_surface_create(alpha ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24, width, height); if (cairo_surface_status(bmp->bmp) != CAIRO_STATUS_SUCCESS) implbug("error creating bitmap: %s", cairo_status_to_string(cairo_surface_status(bmp->bmp))); diff --git a/src/libui_sdl/libui/windows/draw.cpp b/src/libui_sdl/libui/windows/draw.cpp index 11a777d..9a815b9 100644 --- a/src/libui_sdl/libui/windows/draw.cpp +++ b/src/libui_sdl/libui/windows/draw.cpp @@ -522,7 +522,7 @@ void uiDrawRestore(uiDrawContext *c) // bitmap API -uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height) +uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height, int alpha) { uiDrawBitmap* bmp; HRESULT hr; @@ -532,7 +532,8 @@ uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height) D2D1_BITMAP_PROPERTIES bp2 = D2D1::BitmapProperties(); bp2.dpiX = 0; bp2.dpiY = 0; - bp2.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE); + bp2.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, + alpha ? D2D1_ALPHA_MODE_PREMULTIPLIED : D2D1_ALPHA_MODE_IGNORE); //c->rt->BeginDraw(); |