Caches.h revision a2341a9f6addcd79723965ec5b1a1c5ae0f8bd65
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 35namespace android { 36namespace uirenderer { 37 38struct CacheLogger { 39 CacheLogger() { 40 LOGD("Creating caches"); 41 } 42}; // struct CacheLogger 43 44class Caches: public Singleton<Caches> { 45 Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO), 46 lastDstMode(GL_ZERO), currentProgram(NULL) { 47 } 48 49 friend class Singleton<Caches>; 50 51 CacheLogger logger; 52 53public: 54 bool blend; 55 GLenum lastSrcMode; 56 GLenum lastDstMode; 57 Program* currentProgram; 58 59 TextureCache textureCache; 60 LayerCache layerCache; 61 GradientCache gradientCache; 62 ProgramCache programCache; 63 PathCache pathCache; 64 PatchCache patchCache; 65 TextDropShadowCache dropShadowCache; 66 GammaFontRenderer fontRenderer; 67}; // class Caches 68 69}; // namespace uirenderer 70 71#ifdef USE_OPENGL_RENDERER 72using namespace uirenderer; 73ANDROID_SINGLETON_STATIC_INSTANCE(Caches); 74#endif 75 76}; // namespace android 77 78#endif // ANDROID_UI_CACHES_H 79