| Romain Guy | f7f9355 | 2010-07-08 19:17:03 -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_PATCH_CACHE_H | 
|  | 18 | #define ANDROID_UI_PATCH_CACHE_H | 
|  | 19 |  | 
| Romain Guy | 2728f96 | 2010-10-08 18:36:15 -0700 | [diff] [blame^] | 20 | #include <utils/KeyedVector.h> | 
|  | 21 |  | 
| Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 22 | #include "Patch.h" | 
| Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 23 |  | 
|  | 24 | namespace android { | 
|  | 25 | namespace uirenderer { | 
|  | 26 |  | 
|  | 27 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 28 | // Defines | 
|  | 29 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 30 |  | 
|  | 31 | // Debug | 
|  | 32 | #define DEBUG_PATCHES 0 | 
|  | 33 |  | 
|  | 34 | // Debug | 
|  | 35 | #if DEBUG_PATCHES | 
|  | 36 | #define PATCH_LOGD(...) LOGD(__VA_ARGS__) | 
|  | 37 | #else | 
|  | 38 | #define PATCH_LOGD(...) | 
|  | 39 | #endif | 
|  | 40 |  | 
|  | 41 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 42 | // Cache | 
|  | 43 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 44 |  | 
| Romain Guy | 2728f96 | 2010-10-08 18:36:15 -0700 | [diff] [blame^] | 45 | class PatchCache { | 
| Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 46 | public: | 
| Romain Guy | fb8b763 | 2010-08-23 21:05:08 -0700 | [diff] [blame] | 47 | PatchCache(); | 
| Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 48 | PatchCache(uint32_t maxCapacity); | 
|  | 49 | ~PatchCache(); | 
|  | 50 |  | 
| Romain Guy | 2728f96 | 2010-10-08 18:36:15 -0700 | [diff] [blame^] | 51 | Patch* get(const float bitmapWidth, const float bitmapHeight, | 
|  | 52 | const float pixelWidth, const float pixelHeight, | 
|  | 53 | const int32_t* xDivs, const int32_t* yDivs, | 
|  | 54 | const uint32_t width, const uint32_t height); | 
| Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 55 | void clear(); | 
|  | 56 |  | 
|  | 57 | private: | 
| Romain Guy | 2728f96 | 2010-10-08 18:36:15 -0700 | [diff] [blame^] | 58 | uint32_t mMaxEntries; | 
|  | 59 | KeyedVector<PatchDescription, Patch*> mCache; | 
| Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 60 | }; // class PatchCache | 
|  | 61 |  | 
|  | 62 | }; // namespace uirenderer | 
|  | 63 | }; // namespace android | 
|  | 64 |  | 
|  | 65 | #endif // ANDROID_UI_PATCH_CACHE_H |