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