diff options
author | Vicent Marti | 2008-09-07 09:43:10 +0000 |
---|---|---|
committer | Vicent Marti | 2008-09-07 09:43:10 +0000 |
commit | dcc2caf6d07592eb63085c32e39cab27d027cf36 (patch) | |
tree | b80ecbe48f6e76848990f82ab8c2b273c0639bef /graphics | |
parent | e0592c7d25acd42cd93b9dab5048209bab858ba8 (diff) | |
download | scummvm-rg350-dcc2caf6d07592eb63085c32e39cab27d027cf36.tar.gz scummvm-rg350-dcc2caf6d07592eb63085c32e39cab27d027cf36.tar.bz2 scummvm-rg350-dcc2caf6d07592eb63085c32e39cab27d027cf36.zip |
Misc performance fixes.
svn-id: r34398
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/VectorRendererSpec.cpp | 29 | ||||
-rw-r--r-- | graphics/VectorRendererSpec.h | 33 |
2 files changed, 22 insertions, 40 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 428ec7ee5e..7e1164b2de 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -75,9 +75,9 @@ const uint16 inv_sqrt_tbl[] = { inline uint32 fp_sqroot(uint32 x) { int bit; -#if defined(__arm__) - __asm__ ("clz %0, %1\nrsb %0, %0, #31\n" : "=r"(bit) : "r" (x)); -#elif defined(__i386__) +//#if defined(ARM9) +// __asm__ ("clz %0, %1\nrsb %0, %0, #31\n" : "=r"(bit) : "r" (x)); +#if defined(__i386__) __asm__("bsrl %1, %0" : "=r" (bit) : "r" (x)); #else unsigned int mask = 0x40000000; @@ -100,7 +100,10 @@ inline uint32 circleSqrt(int x) { } -/** HELPER MACROS for BESENHALM's circle drawing algorithm **/ +/* + HELPER MACROS for Bresenham's circle drawing algorithm + Note the proper spelling on this header. +*/ #define __BE_ALGORITHM() { \ if (f >= 0) { \ y--; \ @@ -175,17 +178,6 @@ inline uint32 circleSqrt(int x) { blendPixelPtr(ptr4 + (y) + (px), color, a); \ } -/*#define __WU_ALGORITHM() { \ - oldT = T; \ - T = fp_sqroot(rsq - ((y * y) << 16)) ^ 0xFFFF; \ - py += p; \ - if (T < oldT) { \ - x--; px -= p; \ - } \ - a2 = (T >> 8); \ - a1 = ~a2; \ -} */ - // optimized Wu's algorithm #define __WU_ALGORITHM() {\ py += p; \ @@ -400,13 +392,6 @@ applyScreenShading(GUI::Theme::ShadingStyle shadingStyle) { template <typename PixelType, typename PixelFormat> inline void VectorRendererSpec<PixelType, PixelFormat>:: blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) { - if (!ptr) return; - - if (alpha == 255) { - *ptr = color; - return; - } - register int idst = *ptr; register int isrc = color; diff --git a/graphics/VectorRendererSpec.h b/graphics/VectorRendererSpec.h index f9669bdb41..77336e329e 100644 --- a/graphics/VectorRendererSpec.h +++ b/graphics/VectorRendererSpec.h @@ -76,15 +76,15 @@ public: void setBevelColor(uint8 r, uint8 g, uint8 b) { _bevelColor = RGBToColor<PixelFormat>(r, g, b); } void setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2); - virtual void copyFrame(OSystem *sys, const Common::Rect &r); - virtual void copyWholeFrame(OSystem *sys) { copyFrame(sys, Common::Rect(0, 0, _activeSurface->w, _activeSurface->h)); } + void copyFrame(OSystem *sys, const Common::Rect &r); + void copyWholeFrame(OSystem *sys) { copyFrame(sys, Common::Rect(0, 0, _activeSurface->w, _activeSurface->h)); } - virtual void fillSurface(); - virtual void blitSurface(const Graphics::Surface *source, const Common::Rect &r); - virtual void blitSubSurface(const Graphics::Surface *source, const Common::Rect &r); - virtual void blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r); + void fillSurface(); + void blitSurface(const Graphics::Surface *source, const Common::Rect &r); + void blitSubSurface(const Graphics::Surface *source, const Common::Rect &r); + void blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r); - virtual void applyScreenShading(GUI::Theme::ShadingStyle shadingStyle); + void applyScreenShading(GUI::Theme::ShadingStyle shadingStyle); protected: @@ -96,7 +96,7 @@ protected: * @param y Vertical coordinate of the pixel. * @param color Color of the pixel */ - virtual inline void putPixel(int x, int y, PixelType color) { + inline void putPixel(int x, int y, PixelType color) { PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x, y); *ptr = color; } @@ -110,11 +110,8 @@ protected: * @param color Color of the pixel * @param alpha Alpha intensity of the pixel (0-255) */ - virtual inline void blendPixel(int x, int y, PixelType color, uint8 alpha) { - if (alpha == 255) - putPixel(x, y, color); - else if (alpha > 0) - blendPixelPtr((PixelType*)Base::_activeSurface->getBasePtr(x, y), color, alpha); + inline void blendPixel(int x, int y, PixelType color, uint8 alpha) { + blendPixelPtr((PixelType*)Base::_activeSurface->getBasePtr(x, y), color, alpha); } /** @@ -129,7 +126,7 @@ protected: * @param color Color of the pixel * @param alpha Alpha intensity of the pixel (0-255) */ - virtual inline void blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha); + inline void blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha); /** * PRIMITIVE DRAWING ALGORITHMS @@ -194,7 +191,7 @@ protected: * @param max Maximum amount of the progress. * @return Composite color of the gradient at the given "progress" amount. */ - virtual inline PixelType calcGradient(uint32 pos, uint32 max); + inline PixelType calcGradient(uint32 pos, uint32 max); /** * Fills several pixels in a row with a given color and the specifed alpha blending. @@ -206,7 +203,7 @@ protected: * @param color Color of the pixel * @param alpha Alpha intensity of the pixel (0-255) */ - virtual inline void blendFill(PixelType *first, PixelType *last, PixelType color, uint8 alpha) { + inline void blendFill(PixelType *first, PixelType *last, PixelType color, uint8 alpha) { while (first != last) blendPixelPtr(first++, color, alpha); } @@ -226,9 +223,9 @@ protected: * @param last Pointer to the last pixel to fill. * @param color Color of the pixel */ - virtual inline void colorFill(PixelType *first, PixelType *last, PixelType color); + inline void colorFill(PixelType *first, PixelType *last, PixelType color); - virtual void areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset); + void areaConvolution(const Common::Rect &area, const int filter[3][3], int filterDiv, int offset); PixelType _fgColor; /** Foreground color currently being used to draw on the renderer */ PixelType _bgColor; /** Background color currently being used to draw on the renderer */ |