ScummVM API documentation
tiledsurface.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 #ifndef BACKENDS_GRAPHICS3D_OPENGL_TILED_SURFACE_H
23 #define BACKENDS_GRAPHICS3D_OPENGL_TILED_SURFACE_H
24 
25 #include "graphics/opengl/system_headers.h"
26 
27 #include "common/array.h"
28 #include "common/rect.h"
29 
30 #include "graphics/surface.h"
31 
32 namespace OpenGL {
33 
34 class TextureGL;
35 class SurfaceRenderer;
36 
40 class TiledSurface {
41 public:
42  TiledSurface(uint width, uint height, const Graphics::PixelFormat &pixelFormat);
43  ~TiledSurface();
44 
59  void copyRectToSurface(const void *src, int srcPitch, int x, int y, int w, int h);
60 
64  void update();
65 
75  void draw(SurfaceRenderer *surfaceRenderer) const;
76 
82  void fill(uint32 color);
83 
91 
98  const Graphics::Surface *getBackingSurface() const;
99 
106  uint16 getWidth() const { return _backingSurface.w; }
107  uint16 getHeight() const { return _backingSurface.h; }
108 
109 private:
110  static const uint maxTextureSize = 256;
111 
112  struct Tile {
113  TextureGL *texture;
114  Common::Rect rect;
115  bool dirty;
116  };
117 
118  Graphics::Surface _backingSurface;
119  Common::Array<Tile> _tiles;
120 
121  void invalidateAllTiles();
122 };
123 
124 } // End of namespace OpenGL
125 
126 #endif
Definition: surface.h:67
int16 h
Definition: surface.h:76
Definition: pixelformat.h:138
void draw(SurfaceRenderer *surfaceRenderer) const
uint16 getWidth() const
Definition: tiledsurface.h:106
Definition: rect.h:144
void fill(uint32 color)
Definition: renderbuffer.h:27
Definition: surfacerenderer.h:37
void copyRectToSurface(const void *src, int srcPitch, int x, int y, int w, int h)
int16 w
Definition: surface.h:71
Definition: tiledsurface.h:40
Graphics::Surface * getBackingSurface()