37b885b269ac003a133d90432fe9a17136d5b654
[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     };
39     virtual void beginLayer(Layer* layer) = 0;
40     virtual void endLayer() = 0;
41
42     virtual bool needsRedraw(Layer *layer) = 0;
43     virtual bool needsRedraw(LayerList layers) = 0;
44     virtual void renderSWLayer(Layer* layer, bool clear) = 0;
45     virtual void renderSWLayers(LayerList layers, bool clear) = 0;
46
47     virtual void setBaseWindowSystem(BaseWindowSystem* windowSystem)
48     {
49         m_baseWindowSystem = windowSystem;
50     }
51
52     virtual void activateGraphicContext() = 0;
53     virtual void releaseGraphicContext() = 0;
54     virtual void clearBackground() = 0;
55     virtual void swapBuffers() = 0;
56     virtual void saveScreenShotOfFramebuffer(std::string fileToSave) = 0;
57     virtual bool setOptimizationMode(unsigned int id, unsigned int mode)
58     {
59         (void)id;
60         (void)mode;
61         return false;
62     }
63     virtual bool getOptimizationMode(unsigned int id, unsigned int *mode)
64     {
65         (void)id;
66         (void)mode;
67         return false;
68     }
69
70     virtual void setTextureBinder(ITextureBinder* binder)
71     {
72         m_binder = binder;
73     }
74     virtual ITextureBinder* getTextureBinder()
75     {
76         return m_binder;
77     }
78     virtual void renderSurface(Surface*)=0;
79
80     virtual void updateScreenList(LmScreenList& screenList)
81     {
82         (void)screenList;
83     }
84
85     virtual void switchScreen(uint screenID)
86     {
87         (void)screenID;
88     }
89
90 protected:
91     BaseWindowSystem* m_baseWindowSystem;
92     ITextureBinder* m_binder;
93 };
94
95 #endif /* _BASEGRAPHICSYSTEM_H_ */