Caches.h revision b45c0c9774bd19a9dbe77d149abae4e124b08bf6
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_UI_CACHES_H
18#define ANDROID_UI_CACHES_H
19
20#define LOG_TAG "OpenGLRenderer"
21
22#include <utils/Singleton.h>
23
24#include "TextureCache.h"
25#include "LayerCache.h"
26#include "GradientCache.h"
27#include "PatchCache.h"
28#include "GammaFontRenderer.h"
29#include "ProgramCache.h"
30#include "PathCache.h"
31#include "TextDropShadowCache.h"
32
33namespace android {
34namespace uirenderer {
35
36struct CacheLogger {
37    CacheLogger() {
38        LOGD("Creating caches");
39    }
40}; // struct CacheLogger
41
42class Caches: public Singleton<Caches> {
43    Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO),
44            lastDstMode(GL_ZERO), currentProgram(NULL) {
45    }
46
47    friend class Singleton<Caches>;
48
49    CacheLogger logger;
50
51public:
52    bool blend;
53    GLenum lastSrcMode;
54    GLenum lastDstMode;
55    Program* currentProgram;
56
57    TextureCache textureCache;
58    LayerCache layerCache;
59    GradientCache gradientCache;
60    ProgramCache programCache;
61    PathCache pathCache;
62    PatchCache patchCache;
63    TextDropShadowCache dropShadowCache;
64    GammaFontRenderer fontRenderer;
65}; // class Caches
66
67}; // namespace uirenderer
68
69#ifdef USE_OPENGL_RENDERER
70using namespace uirenderer;
71ANDROID_SINGLETON_STATIC_INSTANCE(Caches);
72#endif
73
74}; // namespace android
75
76#endif // ANDROID_UI_CACHES_H
77