blob: fda57b8c862cceaeb674554abf4db149fdad98dd [file] [log] [blame]
Romain Guyfb8b7632010-08-23 21:05:08 -07001/*
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"
Romain Guyb45c0c92010-08-26 20:35:23 -070028#include "GammaFontRenderer.h"
Romain Guyfb8b7632010-08-23 21:05:08 -070029#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) {
Romain Guyfb8b7632010-08-23 21:05:08 -070045 }
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;
Romain Guyb45c0c92010-08-26 20:35:23 -070064 GammaFontRenderer fontRenderer;
Romain Guyfb8b7632010-08-23 21:05:08 -070065}; // class Caches
66
67}; // namespace uirenderer
68
Romain Guyf6fcac72010-08-24 18:17:31 -070069#ifdef USE_OPENGL_RENDERER
Romain Guyfb8b7632010-08-23 21:05:08 -070070using namespace uirenderer;
71ANDROID_SINGLETON_STATIC_INSTANCE(Caches);
Romain Guyf6fcac72010-08-24 18:17:31 -070072#endif
Romain Guyfb8b7632010-08-23 21:05:08 -070073
74}; // namespace android
75
76#endif // ANDROID_UI_CACHES_H