ScummVM API documentation
base_render_osystem.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * This file is based on WME Lite.
24  * http://dead-code.org/redir.php?target=wmelite
25  * Copyright (c) 2011 Jan Nedoma
26  */
27 
28 #ifndef WINTERMUTE_BASE_RENDERER_SDL_H
29 #define WINTERMUTE_BASE_RENDERER_SDL_H
30 
31 #include "engines/wintermute/base/gfx/base_renderer.h"
32 
33 #include "common/rect.h"
34 #include "common/list.h"
35 
36 #include "graphics/managed_surface.h"
37 #include "graphics/transform_struct.h"
38 
39 namespace Wintermute {
40 class BaseSurfaceOSystem;
41 class RenderTicket;
62 public:
63  BaseRenderOSystem(BaseGame *inGame);
64  ~BaseRenderOSystem() override;
65 
67 
68  Common::String getName() const override;
69 
70  bool initRenderer(int width, int height, bool windowed) override;
71  bool flip() override;
72  bool indicatorFlip(int32 x, int32 y, int32 width, int32 height) override;
73  bool forcedFlip() override;
74  bool clear() override;
75  Graphics::PixelFormat getPixelFormat() const override;
76  bool fade(uint16 alpha) override;
77  bool fadeToColor(byte r, byte g, byte b, byte a) override;
78 
79  bool drawLine(int x1, int y1, int x2, int y2, uint32 color) override;
80  bool fillRect(int x, int y, int w, int h, uint32 color) override;
81 
82  BaseImage *takeScreenshot(int newWidth = 0, int newHeight = 0) override;
83  void onWindowChange() override;
84  void setWindowed(bool windowed) override;
85 
86  void invalidateTicket(RenderTicket *renderTicket);
87  void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf);
92  void drawFromTicket(RenderTicket *renderTicket);
98  void drawFromQueuedTicket(const RenderQueueIterator &ticket);
99 
100  bool setViewport(int left, int top, int right, int bottom) override;
101  bool setViewport(Common::Rect32 *rect) override { return BaseRenderer::setViewport(rect); }
102  void modTargetRect(Common::Rect *rect);
103  void pointFromScreen(Common::Point32 *point);
104  void pointToScreen(Common::Point32 *point);
105 
106  float getScaleRatioX() const override {
107  return _ratioX;
108  }
109  float getScaleRatioY() const override {
110  return _ratioY;
111  }
112  bool startSpriteBatch() override;
113  bool endSpriteBatch() override;
114  void endSaveLoad() override;
115  void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Graphics::TransformStruct &transform);
116  BaseSurface *createSurface() override;
117 private:
122  void addDirtyRect(const Common::Rect &rect);
126  void drawTickets();
127  // Non-dirty-rects:
128  void drawFromSurface(RenderTicket *ticket);
129  // Dirty-rects:
130  void drawFromSurface(RenderTicket *ticket, Common::Rect *dstRect, Common::Rect *clipRect);
131  Common::Rect *_dirtyRect;
132  Common::List<RenderTicket *> _renderQueue;
133 
134  bool _needsFlip;
135  RenderQueueIterator _lastFrameIter;
136  Common::Rect _renderRect;
137  Graphics::ManagedSurface *_renderSurface;
138 
139  int _borderLeft;
140  int _borderTop;
141  int _borderRight;
142  int _borderBottom;
143 
144  bool _disableDirtyRects;
145  float _ratioX;
146  float _ratioY;
147  uint32 _clearColor;
148 
149  bool _skipThisFrame;
150  int _lastScreenChangeID; // previous value of OSystem::getScreenChangeID()
151 };
152 
153 } // End of namespace Wintermute
154 
155 #endif
Definition: managed_surface.h:51
Definition: base_game.h:79
Definition: rect.h:526
Definition: str.h:59
Definition: surface.h:67
Definition: base_image.h:45
void drawFromQueuedTicket(const RenderQueueIterator &ticket)
Definition: render_ticket.h:51
bool fadeToColor(byte r, byte g, byte b, byte a) override
Definition: pixelformat.h:138
void drawFromTicket(RenderTicket *renderTicket)
Definition: rect.h:524
bool indicatorFlip(int32 x, int32 y, int32 width, int32 height) override
Definition: base_surface_osystem.h:40
BaseSurface * createSurface() override
Definition: base_surface.h:37
Definition: rect.h:146
Definition: base_render_osystem.h:61
bool fade(uint16 alpha) override
Definition: base_renderer.h:53
Definition: list_intern.h:54
Definition: transform_struct.h:75
Common::String getName() const override
BaseImage * takeScreenshot(int newWidth=0, int newHeight=0) override
Definition: achievements_tables.h:27