diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | src/gui/shoplistbox.cpp | 6 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 4 | ||||
-rw-r--r-- | src/resources/image.cpp | 6 |
4 files changed, 19 insertions, 7 deletions
@@ -1,4 +1,12 @@ -2006-12-23 Bjørn Lindeijer <bjorn@lindeijer.nl> +2006-12-24 Bjørn Lindeijer <bjorn@lindeijer.nl> + + * src/gui/shoplistbox.cpp: Don't try to draw an icon when it is not + defined or failed to load properly. + * src/resources/image.cpp: Major rendering performance increase in + software mode, by not using RLE compression on loaded images while + most of the time, we're only drawing a small subimage of them. + +2006-12-23 Bjørn Lindeijer <bjorn@lindeijer.nl> * configure.ac, data/graphics/items/Makefile.am, data/graphics/items/CMakeLists.txt, data/graphics/images/Makefile.am, diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index f5581323..4821067c 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -89,7 +89,11 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) if (mShopItems) { - graphics->drawImage(mShopItems->at(i).image, 1, y); + Image *icon = mShopItems->at(i).image; + if (icon) + { + graphics->drawImage(icon, 1, y); + } } graphics->drawText(mListModel->getElementAt(i), ITEM_ICON_SIZE + 5, y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index eabb717c..2c69143f 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -199,8 +199,8 @@ Viewport::draw(gcn::Graphics *gcnGraphics) } // Draw target marker if needed - Being *target; - if ((target = player_node->getTarget())) + Being *target = player_node->getTarget(); + if (target) { graphics->setFont(speechFont); graphics->setColor(gcn::Color(255, 32, 32)); diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 48818f6f..9398e06b 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -153,10 +153,10 @@ Image* Image::load(void *buffer, unsigned int bufferSize, SDL_FreeSurface(image); if (hasPink && !hasAlpha) { - SDL_SetColorKey(tmpImage, SDL_SRCCOLORKEY | SDL_RLEACCEL, + SDL_SetColorKey(tmpImage, SDL_SRCCOLORKEY, SDL_MapRGB(tmpImage->format, 255, 0, 255)); } else if (hasAlpha) { - SDL_SetAlpha(tmpImage, SDL_SRCALPHA | SDL_RLEACCEL, SDL_ALPHA_OPAQUE); + SDL_SetAlpha(tmpImage, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); } #ifdef USE_OPENGL @@ -305,7 +305,7 @@ void Image::setAlpha(float a) if (mImage) { // Set the alpha value this image is drawn at - SDL_SetAlpha(mImage, SDL_SRCALPHA | SDL_RLEACCEL, (int)(255 * mAlpha)); + SDL_SetAlpha(mImage, SDL_SRCALPHA, (int) (255 * mAlpha)); } } |