ScummVM API documentation
direct_draw_surface.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 TITANIC_DIRECT_DRAW_SURFACE_H
23 #define TITANIC_DIRECT_DRAW_SURFACE_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "graphics/managed_surface.h"
28 #include "titanic/support/rect.h"
29 
30 namespace Titanic {
31 
32 class TitanicEngine;
33 
34 struct DDSurfaceDesc {
35  int _w;
36  int _h;
37  int _bpp;
38  int _flags;
39  int _caps;
40 
41  DDSurfaceDesc(int w, int h, int bpp) : _w(w), _h(h), _bpp(bpp),
42  _flags(0x1006), _caps(64) {}
43 };
44 
46 private:
47  Graphics::ManagedSurface *_surface;
48  DisposeAfterUse::Flag _disposeAfterUse;
49 public:
52 
56  void create(int w, int h, int bpp);
57 
61  void create(Graphics::ManagedSurface *surface);
62 
66  void free();
67 
71  int getSize() const { return _surface->pitch * _surface->h; }
72 
76  int getWidth() const { return _surface->w; }
77 
81  int getHeight() const { return _surface->h; }
82 
86  int getPitch() const { return _surface->pitch; }
87 
91  const Graphics::PixelFormat &getFormat() { return _surface->format; }
92 
96  Graphics::ManagedSurface *lock(const Rect *bounds, int flags);
97 
101  void unlock();
102 
107  void fill(const Rect *bounds, uint32 color);
108 
112  void fillRect(Rect *rect, byte r, byte g, byte b);
113 
117  void blit(const Rect &destRect, DirectDrawSurface *srcSurface, Rect &srcRect);
118 
122  void blit(const Point &destPos, DirectDrawSurface *srcSurface, Rect *bounds);
123 };
124 
125 } // End of namespace Titanic
126 
127 #endif /* TITANIC_DIRECT_DRAW_SURFACE_H */
Definition: managed_surface.h:51
int16 & w
Definition: managed_surface.h:117
Definition: direct_draw_surface.h:45
Definition: pixelformat.h:138
int32 & pitch
Definition: managed_surface.h:119
int getSize() const
Definition: direct_draw_surface.h:71
int16 & h
Definition: managed_surface.h:118
int getHeight() const
Definition: direct_draw_surface.h:81
Definition: rect.h:35
Definition: rect.h:45
Definition: arm.h:30
const Graphics::PixelFormat & getFormat()
Definition: direct_draw_surface.h:91
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:168
Definition: direct_draw_surface.h:34
PixelFormat & format
Definition: managed_surface.h:120
int getWidth() const
Definition: direct_draw_surface.h:76
int getPitch() const
Definition: direct_draw_surface.h:86