aboutsummaryrefslogtreecommitdiff
path: root/graphics/VectorRendererSpec.h
diff options
context:
space:
mode:
authorMax Horn2009-02-13 00:03:13 +0000
committerMax Horn2009-02-13 00:03:13 +0000
commita3516483587b736922901ae74305dcf6f043987c (patch)
tree12628d0bdec856c17e467d9c031c40215110c020 /graphics/VectorRendererSpec.h
parent2844c2213614c8db5068026e2fc0d11efb3d7e74 (diff)
downloadscummvm-rg350-a3516483587b736922901ae74305dcf6f043987c.tar.gz
scummvm-rg350-a3516483587b736922901ae74305dcf6f043987c.tar.bz2
scummvm-rg350-a3516483587b736922901ae74305dcf6f043987c.zip
Rewrote VectorRendererSpec & VectorRendererAA to use a Graphics::PixelFormat, instead of relying on color masks -> should fix bug #2537212, possibly at a slow down on low-end systems (a regression which we certainly could resolve, though). Note: I left the PixelType template param in on purpose, in case we want one day to compile in both 16 and 32 bit pixel support simultaneously
svn-id: r36288
Diffstat (limited to 'graphics/VectorRendererSpec.h')
-rw-r--r--graphics/VectorRendererSpec.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/graphics/VectorRendererSpec.h b/graphics/VectorRendererSpec.h
index 045882c955..07d37e1847 100644
--- a/graphics/VectorRendererSpec.h
+++ b/graphics/VectorRendererSpec.h
@@ -42,21 +42,16 @@ namespace Graphics {
* @param PixelType Defines a type which may hold the color value of a single
* pixel, such as "byte" or "uint16" for 8 and 16 BPP respectively.
*
- * @param PixelFormat Defines the type of the PixelFormat struct which contains all
- * the actual information of the pixels being used, as declared in "graphics/colormasks.h"
- *
* TODO: Expand documentation.
*
* @see VectorRenderer
*/
-template<typename PixelType, typename PixelFormat>
+template<typename PixelType>
class VectorRendererSpec : public VectorRenderer {
typedef VectorRenderer Base;
public:
- VectorRendererSpec() {
- _bitmapAlphaColor = RGBToColor<PixelFormat>(255, 0, 255);
- }
+ VectorRendererSpec(PixelFormat format);
void drawLine(int x1, int y1, int x2, int y2);
void drawCircle(int x, int y, int r);
@@ -71,9 +66,9 @@ public:
const Common::Rect &area, Graphics::TextAlign alignH,
GUI::ThemeEngine::TextAlignVertical alignV, int deltax, bool elipsis);
- void setFgColor(uint8 r, uint8 g, uint8 b) { _fgColor = RGBToColor<PixelFormat>(r, g, b); }
- void setBgColor(uint8 r, uint8 g, uint8 b) { _bgColor = RGBToColor<PixelFormat>(r, g, b); }
- void setBevelColor(uint8 r, uint8 g, uint8 b) { _bevelColor = RGBToColor<PixelFormat>(r, g, b); }
+ void setFgColor(uint8 r, uint8 g, uint8 b) { _fgColor = _format.RGBToColor(r, g, b); }
+ void setBgColor(uint8 r, uint8 g, uint8 b) { _bgColor = _format.RGBToColor(r, g, b); }
+ void setBevelColor(uint8 r, uint8 g, uint8 b) { _bevelColor = _format.RGBToColor(r, g, b); }
void setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2);
void copyFrame(OSystem *sys, const Common::Rect &r);
@@ -207,6 +202,9 @@ protected:
while (first != last) blendPixelPtr(first++, color, alpha);
}
+ const PixelFormat _format;
+ const PixelType _redMask, _greenMask, _blueMask, _alphaMask;
+
PixelType _fgColor; /**< Foreground color currently being used to draw on the renderer */
PixelType _bgColor; /**< Background color currently being used to draw on the renderer */
@@ -231,9 +229,13 @@ protected:
* @see VectorRenderer
* @see VectorRendererSpec
*/
-template<typename PixelType, typename PixelFormat>
-class VectorRendererAA : public VectorRendererSpec<PixelType, PixelFormat> {
- typedef VectorRendererSpec<PixelType, PixelFormat> Base;
+template<typename PixelType>
+class VectorRendererAA : public VectorRendererSpec<PixelType> {
+ typedef VectorRendererSpec<PixelType> Base;
+public:
+ VectorRendererAA(PixelFormat format) : VectorRendererSpec<PixelType>(format) {
+ }
+
protected:
/**
* "Wu's Line Antialiasing Algorithm" as published by Xiaolin Wu, July 1991