Merge "Build and package Layer Management service binaries." into tizen
[profile/ivi/layer-management.git] / LayerManagerPlugins / Renderers / Graphic / include / GraphicSystems / BaseGraphicSystem.h
1 /***************************************************************************
2  *
3  * Copyright 2010,2011 BMW Car IT GmbH
4  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *        http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ****************************************************************************/
20
21 #ifndef _BASEGRAPHICSYSTEM_H_
22 #define _BASEGRAPHICSYSTEM_H_
23
24 #include "TextureBinders/ITextureBinder.h"
25 #include "WindowSystems/BaseWindowSystem.h"
26 #include "PlatformSurface.h"
27 #include "Surface.h"
28 #include "Layer.h"
29 #include "LmScreen.h"
30
31 template<class DisplayType, class WindowType>
32 class BaseGraphicSystem
33 {
34 public:
35     virtual bool init(DisplayType display, WindowType window)=0;
36     virtual ~BaseGraphicSystem()
37     {
38         if (m_binder)
39         {
40             delete m_binder;
41         }
42     };
43     virtual void beginLayer(Layer* layer) = 0;
44     virtual void endLayer() = 0;
45
46     virtual bool needsRedraw(Layer *layer) = 0;
47     virtual bool needsRedraw(LayerList layers) = 0;
48     virtual void renderSWLayer(Layer* layer, bool clear) = 0;
49     virtual void renderSWLayers(LayerList layers, bool clear) = 0;
50
51     virtual void setBaseWindowSystem(BaseWindowSystem* windowSystem)
52     {
53         m_baseWindowSystem = windowSystem;
54     }
55
56     virtual void activateGraphicContext() = 0;
57     virtual void releaseGraphicContext() = 0;
58     virtual void clearBackground() = 0;
59     virtual void swapBuffers() = 0;
60     virtual void saveScreenShotOfFramebuffer(std::string fileToSave) = 0;
61     virtual bool setOptimizationMode(unsigned int id, unsigned int mode)
62     {
63         (void)id;
64         (void)mode;
65         return false;
66     }
67     virtual bool getOptimizationMode(unsigned int id, unsigned int *mode)
68     {
69         (void)id;
70         (void)mode;
71         return false;
72     }
73
74     virtual void setTextureBinder(ITextureBinder* binder)
75     {
76         m_binder = binder;
77     }
78     virtual ITextureBinder* getTextureBinder()
79     {
80         return m_binder;
81     }
82     virtual void renderSurface(Surface*)=0;
83
84     virtual void updateScreenList(LmScreenList& screenList)
85     {
86         (void)screenList;
87     }
88
89     virtual void switchScreen(uint screenID)
90     {
91         (void)screenID;
92     }
93
94 protected:
95     BaseWindowSystem* m_baseWindowSystem;
96     ITextureBinder* m_binder;
97 };
98
99 #endif /* _BASEGRAPHICSYSTEM_H_ */