ScummVM API documentation
default_display_client.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 PSP_DEF_DISPLAY_CLIENT_H
23 #define PSP_DEF_DISPLAY_CLIENT_H
24 
29 public:
30  DefaultDisplayClient() : _visible(false), _dirty(true) {}
31 
32  bool isVisible() const { return _visible; }
33  void setVisible(bool v) { _visible = v; setDirty(); }
34  Buffer &buffer() { return _buffer; }
35  Palette &palette() { return _palette; }
36  void init();
37  bool allocate(bool bufferInVram = false, bool paletteInVram = false);
38  void deallocate();
39  void clearBuffer();
40  void clearPalette();
41  void render() { _renderer.render(); }
42  uint32 getWidth() const { return _buffer.getSourceWidth(); }
43  uint32 getHeight() const { return _buffer.getSourceHeight(); }
44  void setPartialPalette(const byte *colors, uint start, uint num) { setDirty(); return _palette.setPartial(colors, start, num); }
45  void getPartialPalette(byte *colors, uint start, uint num) const {
46  return _palette.getPartial(colors, start, num);
47  }
48  void copyFromRect(const byte *buf, int pitch, int destX, int destY, int recWidth, int recHeight);
49  void copyToArray(byte *dst, int pitch);
50  void setDirty() { _dirty = true; }
51  void setClean() { _dirty = false; }
52  bool isDirty() const { return _dirty; }
53 
54 protected:
55  Buffer _buffer;
56  Palette _palette;
57  GuRenderer _renderer;
58  bool _visible;
59  bool _dirty;
60 };
61 
65 class Overlay : public DefaultDisplayClient {
66 public:
67  void init();
68  bool allocate();
69  void setBytesPerPixel(uint32 size);
70  void setSize(uint32 width, uint32 height);
71  void copyToArray(void *buf, int pitch);
72  void copyFromRect(const void *buf, int pitch, int x, int y, int w, int h);
73 };
74 
78 class Screen : public DefaultDisplayClient {
79 public:
80  Screen() : _shakeXOffset(0), _shakeYOffset(0) {
81  memset(&_pixelFormat, 0, sizeof(_pixelFormat));
82  memset(&_frameBuffer, 0, sizeof(_frameBuffer));
83  }
84 
85  void init();
86  bool allocate();
87  void setShakePos(int shakeXOffset, int shakeYOffset);
88  void setScummvmPixelFormat(const Graphics::PixelFormat *format);
89  const Graphics::PixelFormat &getScummvmPixelFormat() const { return _pixelFormat; }
90  Graphics::Surface *lockAndGetForEditing();
91  void unlock() { setDirty(); } // set dirty here because of changes
92  void setSize(uint32 width, uint32 height);
93 
94 private:
95  uint32 _shakeXOffset;
96  uint32 _shakeYOffset;
97  Graphics::PixelFormat _pixelFormat;
98  Graphics::Surface _frameBuffer;
99 };
100 
101 #endif /* PSP_DEF_DISPLAY_CLIENT_H */
Definition: surface.h:67
Definition: pixelformat.h:138
Definition: atari-screen.h:60
Definition: display_client.h:172
Definition: default_display_client.h:65
Definition: display_client.h:113
Definition: display_client.h:40
Definition: default_display_client.h:28
Definition: atari-screen.h:44