1 /*
2  *  ppui/sdl/DisplayDeviceFB_SDL.h
3  *
4  *  Copyright 2009 Peter Barth
5  *
6  *  This file is part of Milkytracker.
7  *
8  *  Milkytracker is free software: you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation, either version 3 of the License, or
11  *  (at your option) any later version.
12  *
13  *  Milkytracker is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with Milkytracker.  If not, see <http://www.gnu.org/licenses/>.
20  *
21  *  12/5/14 - Dale Whinham
22  *    - Port to SDL2
23  *
24  */
25 
26 /////////////////////////////////////////////////////////////////
27 //
28 //	Our display device
29 //
30 /////////////////////////////////////////////////////////////////
31 #ifndef __DISPLAYDEVICEFB_H__
32 #define __DISPLAYDEVICEFB_H__
33 
34 #include "DisplayDevice_SDL.h"
35 
36 class PPDisplayDeviceFB : public PPDisplayDevice
37 {
38 private:
39 	bool needsTemporaryBuffer;
40 	pp_uint8* temporaryBuffer;
41 	pp_uint32 temporaryBufferPitch, temporaryBufferBPP;
42 
43 	// used for rotating coordinates etc.
44 	void swap(const PPRect& r);
45 
46 public:
47 	PPDisplayDeviceFB(pp_int32 width,
48 					  pp_int32 height,
49 					  pp_int32 scaleFactor,
50 					  pp_int32 bpp,
51 					  bool fullScreen,
52 					  Orientations theOrientation = ORIENTATION_NORMAL,
53 					  bool swapRedBlue = false);
54 
55 	virtual ~PPDisplayDeviceFB();
56 
supportsScaling()57 	virtual bool supportsScaling() const { return true; }
58 	virtual void setSize(const PPSize& size);
59 
60 	virtual PPGraphicsAbstract* open();
61 	virtual void close();
62 
63 	void update();
64 	void update(const PPRect& r);
65 protected:
66 	SDL_Surface* theSurface;
67 	SDL_Texture* theTexture;
68 	SDL_Renderer* theRenderer;
69 };
70 
71 #endif
72