Caches.h revision 29d8997bd43b7c4ad37fc3d6f91eaafa74913c88
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#ifndef LOG_TAG 21 #define LOG_TAG "OpenGLRenderer" 22#endif 23 24#include <utils/Singleton.h> 25 26#include "TextureCache.h" 27#include "LayerCache.h" 28#include "GradientCache.h" 29#include "PatchCache.h" 30#include "GammaFontRenderer.h" 31#include "ProgramCache.h" 32#include "PathCache.h" 33#include "TextDropShadowCache.h" 34#include "Line.h" 35 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) { 48 } 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; 67 GammaFontRenderer fontRenderer; 68 69 Line line; 70}; // class Caches 71 72}; // namespace uirenderer 73 74#ifdef USE_OPENGL_RENDERER 75using namespace uirenderer; 76ANDROID_SINGLETON_STATIC_INSTANCE(Caches); 77#endif 78 79}; // namespace android 80 81#endif // ANDROID_UI_CACHES_H 82