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/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() override;
73  bool forcedFlip() override;
74  bool fill(byte r, byte g, byte b, Common::Rect *rect = nullptr) override;
75  Graphics::PixelFormat getPixelFormat() const override;
76  void fade(uint16 alpha) override;
77  void 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 
81  BaseImage *takeScreenshot() override;
82  void onWindowChange() override;
83  void setWindowed(bool windowed) override;
84 
85  void invalidateTicket(RenderTicket *renderTicket);
86  void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf);
91  void drawFromTicket(RenderTicket *renderTicket);
97  void drawFromQueuedTicket(const RenderQueueIterator &ticket);
98 
99  bool setViewport(int left, int top, int right, int bottom) override;
100  bool setViewport(Rect32 *rect) override { return BaseRenderer::setViewport(rect); }
101  Rect32 getViewPort() override;
102  void modTargetRect(Common::Rect *rect);
103  void pointFromScreen(Point32 *point);
104  void pointToScreen(Point32 *point);
105 
106  void dumpData(const char *filename) override;
107 
108  float getScaleRatioX() const override {
109  return _ratioX;
110  }
111  float getScaleRatioY() const override {
112  return _ratioY;
113  }
114  bool startSpriteBatch() override;
115  bool endSpriteBatch() override;
116  void endSaveLoad() override;
117  void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Graphics::TransformStruct &transform);
118  BaseSurface *createSurface() override;
119 private:
124  void addDirtyRect(const Common::Rect &rect);
128  void drawTickets();
129  // Non-dirty-rects:
130  void drawFromSurface(RenderTicket *ticket);
131  // Dirty-rects:
132  void drawFromSurface(RenderTicket *ticket, Common::Rect *dstRect, Common::Rect *clipRect);
133  Common::Rect *_dirtyRect;
134  Common::List<RenderTicket *> _renderQueue;
135 
136  bool _needsFlip;
137  RenderQueueIterator _lastFrameIter;
138  Common::Rect _renderRect;
139  Graphics::Surface *_renderSurface;
140  Graphics::Surface *_blankSurface;
141 
142  int _borderLeft;
143  int _borderTop;
144  int _borderRight;
145  int _borderBottom;
146 
147  bool _disableDirtyRects;
148  float _ratioX;
149  float _ratioY;
150  uint32 _clearColor;
151 
152  bool _skipThisFrame;
153  int _lastScreenChangeID; // previous value of OSystem::getScreenChangeID()
154 };
155 
156 } // End of namespace Wintermute
157 
158 #endif
Definition: base_game.h:75
Definition: str.h:59
Definition: surface.h:67
void fade(uint16 alpha) override
bool fill(byte r, byte g, byte b, Common::Rect *rect=nullptr) override
Definition: base_image.h:45
void drawFromQueuedTicket(const RenderQueueIterator &ticket)
Definition: render_ticket.h:51
Definition: pixelformat.h:138
Definition: rect32.h:31
void drawFromTicket(RenderTicket *renderTicket)
Definition: rect.h:144
void fadeToColor(byte r, byte g, byte b, byte a) override
Definition: base_surface_osystem.h:40
BaseSurface * createSurface() override
Definition: rect32.h:60
Definition: base_surface.h:38
Definition: base_render_osystem.h:61
BaseImage * takeScreenshot() override
Definition: base_renderer.h:53
Definition: list_intern.h:51
Definition: transform_struct.h:75
Common::String getName() const override
Definition: achievements_tables.h:27