wind+libui: Ignore alpha bits in the window buffer
This commit is contained in:
parent
5087b6db30
commit
a863b17746
@ -69,5 +69,13 @@ namespace ui
|
||||
* @param stride The number of pixels to skip to go to the next line.
|
||||
*/
|
||||
void fill(u32* pixels, int stride);
|
||||
|
||||
/**
|
||||
* @brief Fill the canvas with pixels, without doing any extra processing.
|
||||
*
|
||||
* @param pixels The array of pixels (must be at least width*height).
|
||||
* @param stride The number of pixels to skip to go to the next line.
|
||||
*/
|
||||
void copy(u32* pixels, int stride);
|
||||
};
|
||||
};
|
||||
|
@ -7,6 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <luna/CString.h>
|
||||
#include <ui/Canvas.h>
|
||||
|
||||
namespace ui
|
||||
@ -59,4 +60,16 @@ namespace ui
|
||||
p += stride * sizeof(Color);
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::copy(u32* pixels, int _stride)
|
||||
{
|
||||
u8* p = ptr;
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
u32* colorp = (u32*)p;
|
||||
memcpy(colorp, pixels, width * sizeof(u32));
|
||||
pixels += _stride;
|
||||
p += stride * sizeof(Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ void Window::draw(ui::Canvas& screen)
|
||||
dirty = false;
|
||||
|
||||
auto window = screen.subcanvas(surface);
|
||||
window.fill(pixels, surface.width);
|
||||
window.copy(pixels, surface.width);
|
||||
}
|
||||
|
||||
void Window::focus()
|
||||
|
Loading…
Reference in New Issue
Block a user