projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e479e18
)
Copy the palette of indexed images, fixes issue with the boats worldmap path which...
author
Ingo Ruhnke
<grumbel@gmx.de>
Sun, 6 Dec 2009 21:40:01 +0000
(21:40 +0000)
committer
Ingo Ruhnke
<grumbel@gmx.de>
Sun, 6 Dec 2009 21:40:01 +0000
(21:40 +0000)
SVN-Revision: 6187
src/video/texture_manager.cpp
patch
|
blob
|
history
diff --git
a/src/video/texture_manager.cpp
b/src/video/texture_manager.cpp
index
6caf485
..
3831132
100644
(file)
--- a/
src/video/texture_manager.cpp
+++ b/
src/video/texture_manager.cpp
@@
-121,7
+121,10
@@
TextureManager::create_image_texture_raw(const std::string& filename, const Rect
}
else
{
}
else
{
- SDLSurfacePtr subimage(SDL_CreateRGBSurfaceFrom(static_cast<uint8_t*>(image->pixels) + rect.top * image->pitch + rect.left * image->format->BytesPerPixel,
+ SDLSurfacePtr subimage(SDL_CreateRGBSurfaceFrom(static_cast<uint8_t*>(image->pixels) +
+ rect.top * image->pitch +
+ rect.left * image->format->BytesPerPixel,
+
rect.get_width(), rect.get_height(),
image->format->BitsPerPixel,
image->pitch,
rect.get_width(), rect.get_height(),
image->format->BitsPerPixel,
image->pitch,
@@
-135,6
+138,11
@@
TextureManager::create_image_texture_raw(const std::string& filename, const Rect
}
else
{
}
else
{
+ if (image->format->palette)
+ { // copy the image palette to subimage if present
+ SDL_SetColors(subimage.get(), image->format->palette->colors, 0, image->format->palette->ncolors);
+ }
+
Texture* result = VideoSystem::new_texture(subimage.get());
result->set_filename(filename);
return result;
Texture* result = VideoSystem::new_texture(subimage.get());
result->set_filename(filename);
return result;