Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Side by Side Diff: src/core/SkBitmapCache.h

Issue 507483002: retool image cache to be generic cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase + add comment in unlock Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bench/ImageCacheBench.cpp ('k') | src/core/SkBitmapCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkBitmapCache_DEFINED 8 #ifndef SkBitmapCache_DEFINED
9 #define SkBitmapCache_DEFINED 9 #define SkBitmapCache_DEFINED
10 10
11 #include "SkScaledImageCache.h" 11 #include "SkScalar.h"
12
13 class SkBitmap;
14 class SkMipMap;
12 15
13 class SkBitmapCache { 16 class SkBitmapCache {
14 public: 17 public:
15 typedef SkScaledImageCache::ID ID; 18 /**
19 * Search based on the src bitmap and inverse scales in X and Y. If found, returns true and
20 * result will be set to the matching bitmap with its pixels already locked .
21 */
22 static bool Find(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY , SkBitmap* result);
23 static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
24 const SkBitmap& result);
16 25
17 static void Unlock(ID* id) { 26 /**
18 SkScaledImageCache::Unlock(id); 27 * Search based on the bitmap's genID, width, height. If found, returns tru e and
19 } 28 * result will be set to the matching bitmap with its pixels already locked .
20 29 */
21 /* Input: bitmap+inverse_scale */ 30 static bool Find(uint32_t genID, int width, int height, SkBitmap* result);
22 static ID* FindAndLock(const SkBitmap& src, SkScalar invScaleX, SkScalar inv ScaleY, 31 static void Add(uint32_t genID, int width, int height, const SkBitmap& resul t);
23 SkBitmap* result);
24 static ID* AddAndLock(const SkBitmap& src, SkScalar invScaleX, SkScalar invS caleY,
25 const SkBitmap& result);
26
27 /* Input: bitmap_genID+width+height */
28 static ID* FindAndLock(uint32_t genID, int width, int height, SkBitmap* resu lt);
29
30 static ID* AddAndLock(uint32_t genID, int width, int height, const SkBitmap& result);
31 }; 32 };
32 33
33 class SkMipMapCache { 34 class SkMipMapCache {
34 public: 35 public:
35 typedef SkScaledImageCache::ID ID; 36 static const SkMipMap* FindAndRef(const SkBitmap& src);
36 37 static void Add(const SkBitmap& src, const SkMipMap* result);
37 static void Unlock(ID* id) {
38 SkScaledImageCache::Unlock(id);
39 }
40
41 static ID* FindAndLock(const SkBitmap& src, const SkMipMap** result);
42 static ID* AddAndLock(const SkBitmap& src, const SkMipMap* result);
43 }; 38 };
44 39
45 #endif 40 #endif
OLDNEW
« no previous file with comments | « bench/ImageCacheBench.cpp ('k') | src/core/SkBitmapCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698