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 
25 #include "graphics/blit.h"
26 #include "graphics/dirtyrects.h"
27 
32 public:
33  DefaultDisplayClient() : _visible(false), _dirty(true) {}
34 
35  bool isVisible() const { return _visible; }
36  void setVisible(bool v) { _visible = v; setDirty(); }
37  Buffer &buffer() { return _buffer; }
38  Palette &palette() { return _palette; }
39  void init();
40  bool allocate(bool bufferInVram = false, bool paletteInVram = false);
41  void deallocate();
42  void clearBuffer();
43  void clearPalette();
44  void render() { _renderer.render(); }
45  uint32 getWidth() const { return _buffer.getSourceWidth(); }
46  uint32 getHeight() const { return _buffer.getSourceHeight(); }
47  void setPartialPalette(const byte *colors, uint start, uint num) { setDirty(); return _palette.setPartial(colors, start, num); }
48  void getPartialPalette(byte *colors, uint start, uint num) const {
49  return _palette.getPartial(colors, start, num);
50  }
51  void copyFromRect(const byte *buf, int pitch, int destX, int destY, int recWidth, int recHeight);
52  void copyToArray(byte *dst, int pitch);
53  void setDirty() { _dirty = true; }
54  void setClean() { _dirty = false; }
55  bool isDirty() const { return _dirty; }
56 
57 protected:
58  Buffer _buffer;
59  Palette _palette;
60  GuRenderer _renderer;
61  bool _visible;
62  bool _dirty;
63 };
64 
68 class Overlay : public DefaultDisplayClient {
69 public:
70  void init();
71  bool allocate();
72  void setBytesPerPixel(uint32 size);
73  void setSize(uint32 width, uint32 height);
74  void copyToArray(void *buf, int pitch);
75  void copyFromRect(const void *buf, int pitch, int x, int y, int w, int h);
76 };
77 
81 class Screen : public DefaultDisplayClient {
82 public:
83  Screen() : _shakeXOffset(0), _shakeYOffset(0), _convert(false), _blitFunc(nullptr) {}
84  ~Screen() { deallocate(); }
85 
86  void init();
87  bool allocate();
88  void deallocate();
89  void setShakePos(int shakeXOffset, int shakeYOffset);
90  void setScummvmPixelFormat(const Graphics::PixelFormat *format);
91  const Graphics::PixelFormat &getScummvmPixelFormat() const { return _srcFormat; }
92  Graphics::Surface *lockAndGetForEditing();
93  void unlock();
94  void copyFromRect(const byte *buf, int pitch, int destX, int destY, int recWidth, int recHeight);
95  void setSize(uint32 width, uint32 height);
96  void render();
97 
98 private:
99  uint32 _shakeXOffset;
100  uint32 _shakeYOffset;
101  bool _convert;
102  Graphics::PixelFormat _srcFormat;
103  Graphics::PixelFormat _dstFormat;
104  Graphics::Surface _frameBuffer;
105  Graphics::FastBlitFunc _blitFunc;
106  Graphics::DirtyRectList _dirtyRects;
107 };
108 
109 #endif /* PSP_DEF_DISPLAY_CLIENT_H */
Definition: surface.h:67
Definition: pixelformat.h:138
Definition: atari-screen.h:58
Definition: display_client.h:174
Definition: dirtyrects.h:43
Definition: default_display_client.h:68
Definition: display_client.h:113
Definition: display_client.h:40
Definition: default_display_client.h:31
Definition: atari-screen.h:42