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  void modTargetRect(Common::Rect *rect);
102  void pointFromScreen(Point32 *point);
103  void pointToScreen(Point32 *point);
104 
105  void dumpData(const char *filename) override;
106 
107  float getScaleRatioX() const override {
108  return _ratioX;
109  }
110  float getScaleRatioY() const override {
111  return _ratioY;
112  }
113  bool startSpriteBatch() override;
114  bool endSpriteBatch() override;
115  void endSaveLoad() override;
116  void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Graphics::TransformStruct &transform);
117  BaseSurface *createSurface() override;
118 private:
123  void addDirtyRect(const Common::Rect &rect);
127  void drawTickets();
128  // Non-dirty-rects:
129  void drawFromSurface(RenderTicket *ticket);
130  // Dirty-rects:
131  void drawFromSurface(RenderTicket *ticket, Common::Rect *dstRect, Common::Rect *clipRect);
132  Common::Rect *_dirtyRect;
133  Common::List<RenderTicket *> _renderQueue;
134 
135  bool _needsFlip;
136  RenderQueueIterator _lastFrameIter;
137  Common::Rect _renderRect;
138  Graphics::Surface *_renderSurface;
139  Graphics::Surface *_blankSurface;
140 
141  int _borderLeft;
142  int _borderTop;
143  int _borderRight;
144  int _borderBottom;
145 
146  bool _disableDirtyRects;
147  float _ratioX;
148  float _ratioY;
149  uint32 _clearColor;
150 
151  bool _skipThisFrame;
152  int _lastScreenChangeID; // previous value of OSystem::getScreenChangeID()
153 };
154 
155 } // End of namespace Wintermute
156 
157 #endif
Definition: base_game.h:76
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