From a3516483587b736922901ae74305dcf6f043987c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 13 Feb 2009 00:03:13 +0000 Subject: 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 --- graphics/VectorRendererSpec.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'graphics/VectorRendererSpec.h') 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 +template class VectorRendererSpec : public VectorRenderer { typedef VectorRenderer Base; public: - VectorRendererSpec() { - _bitmapAlphaColor = RGBToColor(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(r, g, b); } - void setBgColor(uint8 r, uint8 g, uint8 b) { _bgColor = RGBToColor(r, g, b); } - void setBevelColor(uint8 r, uint8 g, uint8 b) { _bevelColor = RGBToColor(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 -class VectorRendererAA : public VectorRendererSpec { - typedef VectorRendererSpec Base; +template +class VectorRendererAA : public VectorRendererSpec { + typedef VectorRendererSpec Base; +public: + VectorRendererAA(PixelFormat format) : VectorRendererSpec(format) { + } + protected: /** * "Wu's Line Antialiasing Algorithm" as published by Xiaolin Wu, July 1991 -- cgit v1.2.3