00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00040 #ifndef BCGRAPHICSDEVICESDL_H
00041 #define BCGRAPHICSDEVICESDL_H
00042
00043 #include "BIGraphicsDevice.h"
00044 #include "BTWidget.h"
00045 #include <SDL/SDL.h>
00046 #if PLATFORM(MAC)
00047
00048 #include "SDL/SDL_main.h"
00049 #endif
00050
00051 namespace BAL {
00052
00053 class BCNativeImage;
00054
00060 class BCGraphicsDeviceSDL : public BIGraphicsDevice {
00061 public:
00062 BCGraphicsDeviceSDL();
00066 virtual void initialize(uint16_t width, uint16_t height, uint8_t depth);
00070 virtual void finalize();
00071 virtual BINativeImage* createNativeImage(const WebCore::IntSize size);
00072 virtual BINativeImage* createNativeImage(RGBA32Array&, const WebCore::IntSize size);
00073
00077 virtual void copy(const BTWidget&, const BINativeImage&, WebCore::IntRect, WebCore::IntPoint, const uint8_t alphaChannel);
00081 virtual void drawArc(const BTWidget&, const IntRect rect, uint16_t startAngle, uint16_t angleSpan, const WebCore::Color);
00085 virtual void drawEllipse(const BTWidget&, WebCore::IntRect, const WebCore::Color);
00089 virtual void drawLine(const BTWidget&, WebCore::IntPoint, WebCore::IntPoint, const WebCore::Color);
00093 virtual void drawRect(const BTWidget&, WebCore::IntRect, const WebCore::Color);
00097 virtual void fillConvexPolygon(const BTWidget&, size_t numPoints, const WebCore::IntPoint*, const WebCore::Color);
00101 virtual void fillRect(const BTWidget&, WebCore::IntRect, const WebCore::Color);
00105 virtual void setClip(const BTWidget&, WebCore::IntRect);
00109 virtual IntRect clip(const BTWidget&);
00113 virtual void stretchBlit(const BTWidget&, const BINativeImage&, WebCore::IntRect src, WebCore::IntRect dst, const uint8_t alphaChannel);
00114 virtual WebCore::IntSize size() const;
00115 virtual void update(const BTWidget&, const WebCore::IntRect);
00116 virtual void clear(const BTWidget&, const WebCore::IntRect);
00117 private:
00118 inline void drawArc(const BTWidget&, const WebCore::Color, int zone, int xc, int yc, float& x0, float& y0, float x1, float y1, bool doSwap = true);
00119 SDL_Surface* applyTransparency(const BINativeImage&, const uint8_t alphaChannel);
00120
00121 SDL_Surface* m_screen;
00122 #ifndef NDEBUG
00123 bool m_layoutTests;
00124 #endif
00125 };
00126
00127 }
00128
00129 #endif // BCGRAPHICSDEVICESDL_H
00130
00131