blob: 08f78a316af01c984f5644553f850201c4cc9ae2 [file] [log] [blame]
Romain Guyf7f93552010-07-08 19:17:03 -07001/*
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 Guy2728f962010-10-08 18:36:15 -070020#include <utils/KeyedVector.h>
21
Romain Guyf7f93552010-07-08 19:17:03 -070022#include "Patch.h"
Romain Guyf7f93552010-07-08 19:17:03 -070023
24namespace android {
25namespace 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 Guy2728f962010-10-08 18:36:15 -070045class PatchCache {
Romain Guyf7f93552010-07-08 19:17:03 -070046public:
Romain Guyfb8b7632010-08-23 21:05:08 -070047 PatchCache();
Romain Guyf7f93552010-07-08 19:17:03 -070048 PatchCache(uint32_t maxCapacity);
49 ~PatchCache();
50
Romain Guy2728f962010-10-08 18:36:15 -070051 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 Guyf7f93552010-07-08 19:17:03 -070055 void clear();
56
57private:
Romain Guy2728f962010-10-08 18:36:15 -070058 uint32_t mMaxEntries;
59 KeyedVector<PatchDescription, Patch*> mCache;
Romain Guyf7f93552010-07-08 19:17:03 -070060}; // class PatchCache
61
62}; // namespace uirenderer
63}; // namespace android
64
65#endif // ANDROID_UI_PATCH_CACHE_H