blob: 5ef66f31251202512e8bdf7f9fb95cee6a7010ca [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
Romain Guya2341a92010-09-08 18:04:33 -070020#ifndef LOG_TAG
21 #define LOG_TAG "OpenGLRenderer"
22#endif
Romain Guyfb8b7632010-08-23 21:05:08 -070023
24#include <utils/Singleton.h>
25
26#include "TextureCache.h"
27#include "LayerCache.h"
28#include "GradientCache.h"
29#include "PatchCache.h"
Romain Guyb45c0c92010-08-26 20:35:23 -070030#include "GammaFontRenderer.h"
Romain Guyfb8b7632010-08-23 21:05:08 -070031#include "ProgramCache.h"
32#include "PathCache.h"
33#include "TextDropShadowCache.h"
Romain Guy29d89972010-09-22 16:10:57 -070034#include "Line.h"
Romain Guyfb8b7632010-08-23 21:05:08 -070035
36namespace android {
37namespace uirenderer {
38
39struct CacheLogger {
40 CacheLogger() {
41 LOGD("Creating caches");
42 }
43}; // struct CacheLogger
44
45class Caches: public Singleton<Caches> {
46 Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO),
47 lastDstMode(GL_ZERO), currentProgram(NULL) {
Romain Guyfb8b7632010-08-23 21:05:08 -070048 }
49
50 friend class Singleton<Caches>;
51
52 CacheLogger logger;
53
54public:
55 bool blend;
56 GLenum lastSrcMode;
57 GLenum lastDstMode;
58 Program* currentProgram;
59
60 TextureCache textureCache;
61 LayerCache layerCache;
62 GradientCache gradientCache;
63 ProgramCache programCache;
64 PathCache pathCache;
65 PatchCache patchCache;
66 TextDropShadowCache dropShadowCache;
Romain Guyb45c0c92010-08-26 20:35:23 -070067 GammaFontRenderer fontRenderer;
Romain Guy29d89972010-09-22 16:10:57 -070068
69 Line line;
Romain Guyfb8b7632010-08-23 21:05:08 -070070}; // class Caches
71
72}; // namespace uirenderer
73
Romain Guyf6fcac72010-08-24 18:17:31 -070074#ifdef USE_OPENGL_RENDERER
Romain Guyfb8b7632010-08-23 21:05:08 -070075using namespace uirenderer;
76ANDROID_SINGLETON_STATIC_INSTANCE(Caches);
Romain Guyf6fcac72010-08-24 18:17:31 -070077#endif
Romain Guyfb8b7632010-08-23 21:05:08 -070078
79}; // namespace android
80
81#endif // ANDROID_UI_CACHES_H