ScummVM API documentation
atari-pendingscreenchanges.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_GRAPHICS_ATARI_PENDINGSCREENCHANGES_H
23 #define BACKENDS_GRAPHICS_ATARI_PENDINGSCREENCHANGES_H
24 
25 #include <utility>
26 
28 namespace Graphics {
29 class Surface;
30 }
31 
33 public:
35  : _manager(manager) {
36  }
37 
38  void clearTransaction() {
39  _changes &= ~kTransaction;
40  }
41 
42  void setScreenSurface(Graphics::Surface *surface) {
43  _surface = surface;
44  }
45 
46  void queueVideoMode() {
47  _changes |= kVideoMode;
48  }
49  void queueAspectRatioCorrection() {
50  _changes |= kAspectRatioCorrection;
51  }
52  void queuePalette() {
53  _changes |= kPalette;
54  }
55  void queueShakeScreen() {
56  _changes |= kShakeScreen;
57  }
58  void queueAll();
59 
60  int get() const {
61  return _changes;
62  }
63 
64  bool videoMode() const {
65  return _changes & kVideoMode;
66  }
67  bool empty() const {
68  return _changes == kNone;
69  }
70 
71  Graphics::Surface *screenSurface() const {
72  return _surface;
73  }
74  const std::pair<int, bool>& aspectRatioCorrectionYOffset() const {
75  return _aspectRatioCorrectionYOffset;
76  }
77  const std::pair<bool, bool>& screenOffsets() const {
78  return _setScreenOffsets;
79  }
80  const std::pair<bool, bool>& shrinkVidelVisibleArea() const {
81  return _shrinkVidelVisibleArea;
82  }
83 
84  void applyBeforeVblLock();
85  void applyAfterVblLock();
86 
87 private:
88  void processAspectRatioCorrection();
89  void processVideoMode();
90 
91  enum Change {
92  kNone = 0,
93  kVideoMode = 1<<0,
94  kAspectRatioCorrection = 1<<1,
95  kPalette = 1<<2,
96  kShakeScreen = 1<<3,
97  kTransaction = kVideoMode | kAspectRatioCorrection,
98  kAll = kTransaction | kPalette | kShakeScreen
99  };
100  int _changes = kNone;
101 
102  AtariGraphicsManager *_manager;
103 
104  Graphics::Surface *_surface = nullptr;
105 
106  bool _resetSuperVidel;
107  bool _switchToBlackPalette;
108 
109  // <value, set> ... std::optional would be so much better!
110  std::pair<int, bool> _aspectRatioCorrectionYOffset;
111  std::pair<bool, bool> _setScreenOffsets;
112  std::pair<bool, bool> _shrinkVidelVisibleArea;
113 
114 };
115 
116 #endif // ATARI-PENDINGSCREENCHANGES_H
Definition: surface.h:67
Definition: formatinfo.h:28
Definition: atari-pendingscreenchanges.h:32
Definition: atari-graphics.h:40