Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 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 | |
Romain Guy | a2341a9 | 2010-09-08 18:04:33 -0700 | [diff] [blame] | 20 | #ifndef LOG_TAG |
| 21 | #define LOG_TAG "OpenGLRenderer" |
| 22 | #endif |
Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 23 | |
| 24 | #include <utils/Singleton.h> |
| 25 | |
| 26 | #include "TextureCache.h" |
| 27 | #include "LayerCache.h" |
| 28 | #include "GradientCache.h" |
| 29 | #include "PatchCache.h" |
Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -0700 | [diff] [blame] | 30 | #include "GammaFontRenderer.h" |
Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 31 | #include "ProgramCache.h" |
| 32 | #include "PathCache.h" |
| 33 | #include "TextDropShadowCache.h" |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 34 | #include "FboCache.h" |
Romain Guy | 29d8997 | 2010-09-22 16:10:57 -0700 | [diff] [blame] | 35 | #include "Line.h" |
Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 36 | |
| 37 | namespace android { |
| 38 | namespace uirenderer { |
| 39 | |
| 40 | struct CacheLogger { |
| 41 | CacheLogger() { |
| 42 | LOGD("Creating caches"); |
| 43 | } |
| 44 | }; // struct CacheLogger |
| 45 | |
| 46 | class Caches: public Singleton<Caches> { |
| 47 | Caches(): Singleton<Caches>(), blend(false), lastSrcMode(GL_ZERO), |
| 48 | lastDstMode(GL_ZERO), currentProgram(NULL) { |
Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | friend class Singleton<Caches>; |
| 52 | |
| 53 | CacheLogger logger; |
| 54 | |
| 55 | public: |
| 56 | bool blend; |
| 57 | GLenum lastSrcMode; |
| 58 | GLenum lastDstMode; |
| 59 | Program* currentProgram; |
| 60 | |
| 61 | TextureCache textureCache; |
| 62 | LayerCache layerCache; |
| 63 | GradientCache gradientCache; |
| 64 | ProgramCache programCache; |
| 65 | PathCache pathCache; |
| 66 | PatchCache patchCache; |
| 67 | TextDropShadowCache dropShadowCache; |
Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -0700 | [diff] [blame] | 68 | GammaFontRenderer fontRenderer; |
Romain Guy | e2d345e | 2010-09-24 18:39:22 -0700 | [diff] [blame] | 69 | FboCache fboCache; |
Romain Guy | 29d8997 | 2010-09-22 16:10:57 -0700 | [diff] [blame] | 70 | |
| 71 | Line line; |
Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 72 | }; // class Caches |
| 73 | |
| 74 | }; // namespace uirenderer |
| 75 | |
Romain Guy | f6fcac7 | 2010-08-24 18:17:31 -0700 | [diff] [blame] | 76 | #ifdef USE_OPENGL_RENDERER |
Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 77 | using namespace uirenderer; |
| 78 | ANDROID_SINGLETON_STATIC_INSTANCE(Caches); |
Romain Guy | f6fcac7 | 2010-08-24 18:17:31 -0700 | [diff] [blame] | 79 | #endif |
Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 80 | |
| 81 | }; // namespace android |
| 82 | |
| 83 | #endif // ANDROID_UI_CACHES_H |