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 34 ~FrameBufferWin() override; 35 36 void flip(sw::Surface *source) override = 0; 37 void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override = 0; 38 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; 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 60