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

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

Issue 521433002: harden requirements on SkBitmapCache (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') | 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 "SkScalar.h" 11 #include "SkScalar.h"
12 #include "SkBitmap.h"
12 13
13 class SkBitmap;
14 class SkMipMap; 14 class SkMipMap;
15 15
16 class SkBitmapCache { 16 class SkBitmapCache {
17 public: 17 public:
18 /** 18 /**
19 * Use this allocator for bitmaps, so they can use ashmem when available.
20 */
21 static SkBitmap::Allocator* GetAllocator();
22
23 /**
19 * Search based on the src bitmap and inverse scales in X and Y. If found, returns true and 24 * 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 . 25 * result will be set to the matching bitmap with its pixels already locked .
21 */ 26 */
22 static bool Find(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY , SkBitmap* result); 27 static bool Find(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY , SkBitmap* result);
28
29 /*
30 * result must be marked isImmutable()
31 */
23 static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY, 32 static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
24 const SkBitmap& result); 33 const SkBitmap& result);
25 34
26 /** 35 /**
27 * Search based on the bitmap's genID, width, height. If found, returns tru e and 36 * Search based on the bitmap's genID, width, height. If found, returns tru e and
28 * result will be set to the matching bitmap with its pixels already locked . 37 * result will be set to the matching bitmap with its pixels already locked .
29 */ 38 */
30 static bool Find(uint32_t genID, int width, int height, SkBitmap* result); 39 static bool Find(uint32_t genID, int width, int height, SkBitmap* result);
40
41 /*
42 * result must be marked isImmutable()
43 */
31 static void Add(uint32_t genID, int width, int height, const SkBitmap& resul t); 44 static void Add(uint32_t genID, int width, int height, const SkBitmap& resul t);
32 }; 45 };
33 46
34 class SkMipMapCache { 47 class SkMipMapCache {
35 public: 48 public:
36 static const SkMipMap* FindAndRef(const SkBitmap& src); 49 static const SkMipMap* FindAndRef(const SkBitmap& src);
37 static void Add(const SkBitmap& src, const SkMipMap* result); 50 static void Add(const SkBitmap& src, const SkMipMap* result);
38 }; 51 };
39 52
40 #endif 53 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmapCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698