summaryrefslogtreecommitdiff
path: root/LayerManagerPlugins/Renderers/Graphic/include/GraphicSystems/BaseGraphicSystem.h
blob: 47b04d68919a34b42cdb8cc820a614e5c1558e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/***************************************************************************
 *
 * Copyright 2010,2011 BMW Car IT GmbH
 * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ****************************************************************************/

#ifndef _BASEGRAPHICSYSTEM_H_
#define _BASEGRAPHICSYSTEM_H_

#include "TextureBinders/ITextureBinder.h"
#include "WindowSystems/BaseWindowSystem.h"
#include "PlatformSurface.h"
#include "Surface.h"
#include "Layer.h"
#include "LmScreen.h"

template<class DisplayType, class WindowType>
class BaseGraphicSystem
{
public:
    virtual bool init(DisplayType display, WindowType window)=0;
    virtual ~BaseGraphicSystem()
    {
        if (m_binder)
        {
            delete m_binder;
        }
    };
    virtual void beginLayer(Layer* layer) = 0;
    virtual void endLayer() = 0;

    virtual bool needsRedraw(Layer *layer) = 0;
    virtual bool needsRedraw(LayerList layers) = 0;
    virtual void renderSWLayer(Layer* layer, bool clear) = 0;
    virtual void renderSWLayers(LayerList layers, bool clear) = 0;

    virtual void setBaseWindowSystem(BaseWindowSystem* windowSystem)
    {
        m_baseWindowSystem = windowSystem;
    }

    virtual void activateGraphicContext() = 0;
    virtual void releaseGraphicContext() = 0;
    virtual void clearBackground() = 0;
    virtual void swapBuffers() = 0;
    virtual void saveScreenShotOfFramebuffer(std::string fileToSave) = 0;
    virtual bool setOptimizationMode(unsigned int id, unsigned int mode)
    {
        (void)id;
        (void)mode;
        return false;
    }
    virtual bool getOptimizationMode(unsigned int id, unsigned int *mode)
    {
        (void)id;
        (void)mode;
        return false;
    }

    virtual void setTextureBinder(ITextureBinder* binder)
    {
        m_binder = binder;
    }
    virtual ITextureBinder* getTextureBinder()
    {
        return m_binder;
    }
    virtual void renderSurface(Surface*)=0;

    virtual void updateScreenList(LmScreenList& screenList)
    {
        (void)screenList;
    }

    virtual void switchScreen(uint screenID)
    {
        (void)screenID;
    }

protected:
    BaseWindowSystem* m_baseWindowSystem;
    ITextureBinder* m_binder;
};

#endif /* _BASEGRAPHICSYSTEM_H_ */