summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/bitmap.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2012-01-15 01:13:13 +0000
committer Aaron Giles <aaron@aarongiles.com>2012-01-15 01:13:13 +0000
commitd57d1f3273a0c8542ee12ac7dbfa05ceac591061 (patch)
tree0ce77a6150ba41fa726487a0c4f06a6fa532010d /src/lib/util/bitmap.c
parent61cb12528c4ae1a88b70d63e855ddd899bd4e80e (diff)
Added new method screen_device::register_screen_bitmap which
allocates a given bitmap to match the screen size and resizes it as appropriate when the screen size changes. Updated all the obvious spots in the code where this could be leveraged. Move allocate/resize methods in the bitmap classes down into bitmap_t because they no longer have any dependency on the bitmap format or type. Ensured that the bitmap's palette remains set across a resize call (it is lost doing an allocate).
Diffstat (limited to 'src/lib/util/bitmap.c')
-rw-r--r--src/lib/util/bitmap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/util/bitmap.c b/src/lib/util/bitmap.c
index a90d3ee3db1..46c0757be13 100644
--- a/src/lib/util/bitmap.c
+++ b/src/lib/util/bitmap.c
@@ -207,7 +207,12 @@ void bitmap_t::resize(int width, int height, int xslop, int yslop)
// if we need more memory, just realloc
if (new_allocbytes > m_allocbytes)
- return allocate(width, height, xslop, yslop);
+ {
+ palette_t *palette = m_palette;
+ allocate(width, height, xslop, yslop);
+ set_palette(palette);
+ return;
+ }
// otherwise, reconfigure
m_rowpixels = new_rowpixels;