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

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

Issue 576763002: allow SkBitmapCache to operate on a local instance, for testability (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | src/core/SkBitmapCache.cpp » ('j') | src/core/SkBitmapCache.cpp » ('J')
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 "SkScalar.h" 11 #include "SkScalar.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 13
14 class SkResourceCache;
14 class SkMipMap; 15 class SkMipMap;
15 16
16 class SkBitmapCache { 17 class SkBitmapCache {
17 public: 18 public:
18 /** 19 /**
19 * Use this allocator for bitmaps, so they can use ashmem when available. 20 * Use this allocator for bitmaps, so they can use ashmem when available.
20 * Returns NULL if the ResourceCache has not been initialized with a Discard ableFactory. 21 * Returns NULL if the ResourceCache has not been initialized with a Discard ableFactory.
21 */ 22 */
22 static SkBitmap::Allocator* GetAllocator(); 23 static SkBitmap::Allocator* GetAllocator();
23 24
24 /** 25 /**
25 * Search based on the src bitmap and inverse scales in X and Y. If found, returns true and 26 * Search based on the src bitmap and inverse scales in X and Y. If found, returns true and
26 * result will be set to the matching bitmap with its pixels already locked . 27 * result will be set to the matching bitmap with its pixels already locked .
27 */ 28 */
28 static bool Find(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY , SkBitmap* result); 29 static bool Find(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY , SkBitmap* result,
30 SkResourceCache* localCache = NULL);
29 31
30 /* 32 /*
31 * result must be marked isImmutable() 33 * result must be marked isImmutable()
32 */ 34 */
33 static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY, 35 static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
34 const SkBitmap& result); 36 const SkBitmap& result, SkResourceCache* localCache = NULL);
35 37
36 /** 38 /**
37 * Search based on the bitmap's genID and subset. If found, returns true an d 39 * Search based on the bitmap's genID and subset. If found, returns true an d
38 * result will be set to the matching bitmap with its pixels already locked . 40 * result will be set to the matching bitmap with its pixels already locked .
39 */ 41 */
40 static bool Find(uint32_t genID, const SkIRect& subset, SkBitmap* result); 42 static bool Find(uint32_t genID, const SkIRect& subset, SkBitmap* result,
43 SkResourceCache* localCache = NULL);
41 44
42 /** 45 /**
43 * The width and the height of the provided subset must be the same as the r esult bitmap ones. 46 * The width and the height of the provided subset must be the same as the r esult bitmap ones.
44 * result must be marked isImmutable() 47 * result must be marked isImmutable()
45 */ 48 */
46 static bool Add(uint32_t genID, const SkIRect& subset, const SkBitmap& resul t); 49 static bool Add(uint32_t genID, const SkIRect& subset, const SkBitmap& resul t,
50 SkResourceCache* localCache = NULL);
47 }; 51 };
48 52
49 class SkMipMapCache { 53 class SkMipMapCache {
50 public: 54 public:
51 static const SkMipMap* FindAndRef(const SkBitmap& src); 55 static const SkMipMap* FindAndRef(const SkBitmap& src);
52 static void Add(const SkBitmap& src, const SkMipMap* result); 56 static void Add(const SkBitmap& src, const SkMipMap* result);
53 }; 57 };
54 58
55 #endif 59 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmapCache.cpp » ('j') | src/core/SkBitmapCache.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698