Caches.h revision f6fcac7ce16a631ca2b101f5bbebe58af5b247a8
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 "FontRenderer.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 dropShadowCache.setFontRenderer(fontRenderer); 46 } 47 48 friend class Singleton<Caches>; 49 50 CacheLogger logger; 51 52public: 53 bool blend; 54 GLenum lastSrcMode; 55 GLenum lastDstMode; 56 Program* currentProgram; 57 58 TextureCache textureCache; 59 LayerCache layerCache; 60 GradientCache gradientCache; 61 ProgramCache programCache; 62 PathCache pathCache; 63 PatchCache patchCache; 64 TextDropShadowCache dropShadowCache; 65 FontRenderer fontRenderer; 66}; // class Caches 67 68}; // namespace uirenderer 69 70#ifdef USE_OPENGL_RENDERER 71using namespace uirenderer; 72ANDROID_SINGLETON_STATIC_INSTANCE(Caches); 73#endif 74 75}; // namespace android 76 77#endif // ANDROID_UI_CACHES_H 78