blob: 15c1e0e54561485aba94241f6ee2c6a082bea6b5 [file] [log] [blame]
Nicolas Capens0bac2852016-05-07 06:09:58 -04001// 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
20namespace 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 Capens6016a142017-05-29 17:20:36 -040034 ~FrameBufferWin() override;
Nicolas Capens0bac2852016-05-07 06:09:58 -040035
Nicolas Capens241f7892015-12-30 23:40:45 -050036 void flip(sw::Surface *source) override = 0;
37 void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override = 0;
Alexis Hetue97a31e2016-11-14 14:10:47 -050038
Nicolas Capens241f7892015-12-30 23:40:45 -050039 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 Capens0bac2852016-05-07 06:09:58 -040041
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
57sw::FrameBufferWin *createFrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin);
58
59#endif // sw_FrameBufferWin_hpp