30 #include "renderbackend.h"
31 #include "video/devicecaps.h"
37 m_compressimages(false),
38 m_useframebuffer(false),
40 m_isalphaoptimized(false),
41 m_iscolorkeyenabled(false),
43 m_isframelimit(false),
46 m_isbackgroundcolor =
false;
47 m_backgroundcolor.r = 0;
48 m_backgroundcolor.g = 0;
49 m_backgroundcolor.b = 0;
58 SDL_QuitSubSystem(SDL_INIT_VIDEO);
64 m_frame_start = SDL_GetTicks();
70 uint16_t frame_time = SDL_GetTicks() - m_frame_start;
71 const float frame_limit = 1000.0f/m_framelimit;
72 if (frame_time < frame_limit) {
73 SDL_Delay(static_cast<Uint32>(frame_limit) - frame_time);
82 uint32_t RenderBackend::getWidth()
const {
86 uint32_t RenderBackend::getHeight()
const {
90 const Rect& RenderBackend::getArea()
const {
91 static Rect r(0, 0, m_screen->w, m_screen->h);
104 assert(!m_clipstack.empty());
106 if (m_clipstack.empty()) {
109 ClipInfo ci = m_clipstack.top();
115 if (m_clipstack.empty()) {
116 return m_clipstack.top().r;
128 m_iscolorkeyenabled = colorkeyenable;
132 return m_iscolorkeyenabled;
136 m_colorkey = colorkey;
144 if (r != m_backgroundcolor.r || g != m_backgroundcolor.g || b != m_backgroundcolor.b) {
145 m_isbackgroundcolor =
true;
146 m_backgroundcolor.r = r;
147 m_backgroundcolor.g = g;
148 m_backgroundcolor.b = b;
157 return m_rgba_format;
161 m_isframelimit = limited;
165 return m_isframelimit;
169 m_framelimit = framelimit;
virtual void setClipArea(const Rect &cliparea, bool clear)=0
RenderBackend(const SDL_Color &colorkey)
void setColorKey(const SDL_Color &colorkey)
void setBackgroundColor(uint8_t r, uint8_t g, uint8_t b)
bool isFrameLimitEnabled() const
void setColorKeyEnabled(bool colorkeyenable)
uint16_t getFrameLimit() const
void resetBackgroundColor()
bool isColorKeyEnabled() const
void pushClipArea(const Rect &cliparea, bool clear=true)
const SDL_Color & getColorKey() const
virtual void startFrame()
void setFrameLimit(uint16_t framelimit)
void setFrameLimitEnabled(bool limited)
SDL_Surface * getRenderTargetSurface()
const SDL_PixelFormat & getPixelFormat() const
const Rect & getClipArea() const
const ScreenMode & getCurrentScreenMode() const