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