Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 1 | // Copyright 2016 The SwiftShader Authors. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #ifndef sw_FrameBufferWin_hpp |
| 16 | #define sw_FrameBufferWin_hpp |
| 17 | |
| 18 | #include "FrameBuffer.hpp" |
| 19 | |
| 20 | namespace sw |
| 21 | { |
| 22 | struct GammaRamp |
| 23 | { |
| 24 | short red[256]; |
| 25 | short green[256]; |
| 26 | short blue[256]; |
| 27 | }; |
| 28 | |
| 29 | class FrameBufferWin : public FrameBuffer |
| 30 | { |
| 31 | public: |
| 32 | FrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin); |
| 33 | |
Nicolas Capens | 6016a14 | 2017-05-29 17:20:36 -0400 | [diff] [blame] | 34 | ~FrameBufferWin() override; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 35 | |
Nicolas Capens | 241f789 | 2015-12-30 23:40:45 -0500 | [diff] [blame] | 36 | void flip(sw::Surface *source) override = 0; |
| 37 | void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override = 0; |
Alexis Hetu | e97a31e | 2016-11-14 14:10:47 -0500 | [diff] [blame] | 38 | |
Nicolas Capens | 241f789 | 2015-12-30 23:40:45 -0500 | [diff] [blame] | 39 | virtual void flip(HWND windowOverride, sw::Surface *source) = 0; |
| 40 | virtual void blit(HWND windowOverride, sw::Surface *source, const Rect *sourceRect, const Rect *destRect) = 0; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 41 | |
| 42 | virtual void setGammaRamp(GammaRamp *gammaRamp, bool calibrate) = 0; |
| 43 | virtual void getGammaRamp(GammaRamp *gammaRamp) = 0; |
| 44 | |
| 45 | virtual void screenshot(void *destBuffer) = 0; |
| 46 | virtual bool getScanline(bool &inVerticalBlank, unsigned int &scanline) = 0; |
| 47 | |
| 48 | protected: |
| 49 | void updateBounds(HWND windowOverride); |
| 50 | |
| 51 | HWND windowHandle; |
| 52 | DWORD originalWindowStyle; |
| 53 | RECT bounds; |
| 54 | }; |
| 55 | } |
| 56 | |
| 57 | sw::FrameBufferWin *createFrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin); |
| 58 | |
| 59 | #endif // sw_FrameBufferWin_hpp |