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() override;
73  bool forcedFlip() override;
74  bool clear() 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 fillRect(int x, int y, int w, int h, uint32 color) override;
80 
81  BaseImage *takeScreenshot(int newWidth = 0, int newHeight = 0) 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(Common::Rect32 *rect) override { return BaseRenderer::setViewport(rect); }
101  void modTargetRect(Common::Rect *rect);
102  void pointFromScreen(Common::Point32 *point);
103  void pointToScreen(Common::Point32 *point);
104 
105  float getScaleRatioX() const override {
106  return _ratioX;
107  }
108  float getScaleRatioY() const override {
109  return _ratioY;
110  }
111  bool startSpriteBatch() override;
112  bool endSpriteBatch() override;
113  void endSaveLoad() override;
114  void drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Graphics::TransformStruct &transform);
115  BaseSurface *createSurface() override;
116 private:
121  void addDirtyRect(const Common::Rect &rect);
125  void drawTickets();
126  // Non-dirty-rects:
127  void drawFromSurface(RenderTicket *ticket);
128  // Dirty-rects:
129  void drawFromSurface(RenderTicket *ticket, Common::Rect *dstRect, Common::Rect *clipRect);
130  Common::Rect *_dirtyRect;
131  Common::List<RenderTicket *> _renderQueue;
132 
133  bool _needsFlip;
134  RenderQueueIterator _lastFrameIter;
135  Common::Rect _renderRect;
136  Graphics::ManagedSurface *_renderSurface;
137 
138  int _borderLeft;
139  int _borderTop;
140  int _borderRight;
141  int _borderBottom;
142 
143  bool _disableDirtyRects;
144  float _ratioX;
145  float _ratioY;
146  uint32 _clearColor;
147 
148  bool _skipThisFrame;
149  int _lastScreenChangeID; // previous value of OSystem::getScreenChangeID()
150 };
151 
152 } // End of namespace Wintermute
153 
154 #endif
Definition: managed_surface.h:51
Definition: base_game.h:75
Definition: rect.h:526
Definition: str.h:59
Definition: surface.h:67
void fade(uint16 alpha) override
Definition: base_image.h:45
void drawFromQueuedTicket(const RenderQueueIterator &ticket)
Definition: render_ticket.h:51
Definition: pixelformat.h:138
void drawFromTicket(RenderTicket *renderTicket)
Definition: rect.h:524
void fadeToColor(byte r, byte g, byte b, byte a) 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
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