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

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

Issue 539643002: Remove SkBitmapCache::Find/Add(_,width,height,_) in favor of using rect (Closed) Base URL: https://skia.googlesource.com/skia.git@bitmapCache_add_rect
Patch Set: Rebase master 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 | « src/core/SkBitmapCache.h ('k') | src/lazy/SkCachingPixelRef.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 #include "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkResourceCache.h" 9 #include "SkResourceCache.h"
10 #include "SkMipMap.h" 10 #include "SkMipMap.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const SkBitmap& result) { 93 const SkBitmap& result) {
94 if (0 == invScaleX || 0 == invScaleY) { 94 if (0 == invScaleX || 0 == invScaleY) {
95 // degenerate, and the key we use for mipmaps 95 // degenerate, and the key we use for mipmaps
96 return; 96 return;
97 } 97 }
98 SkASSERT(result.isImmutable()); 98 SkASSERT(result.isImmutable());
99 SkResourceCache::Add(SkNEW_ARGS(BitmapRec, (src.getGenerationID(), invScaleX , invScaleY, 99 SkResourceCache::Add(SkNEW_ARGS(BitmapRec, (src.getGenerationID(), invScaleX , invScaleY,
100 get_bounds_from_bitmap(src), res ult))); 100 get_bounds_from_bitmap(src), res ult)));
101 } 101 }
102 102
103 bool SkBitmapCache::Find(uint32_t genID, int width, int height, SkBitmap* result ) {
104 return Find(genID, SkIRect::MakeWH(width, height), result);
105 }
106
107 bool SkBitmapCache::Add(uint32_t genID, int width, int height, const SkBitmap& r esult) {
108 return Add(genID, SkIRect::MakeWH(width, height), result);
109 }
110
111 bool SkBitmapCache::Find(uint32_t genID, const SkIRect& subset, SkBitmap* result ) { 103 bool SkBitmapCache::Find(uint32_t genID, const SkIRect& subset, SkBitmap* result ) {
112 BitmapKey key(genID, SK_Scalar1, SK_Scalar1, subset); 104 BitmapKey key(genID, SK_Scalar1, SK_Scalar1, subset);
113 return find_and_return(key, result); 105 return find_and_return(key, result);
114 } 106 }
115 107
116 bool SkBitmapCache::Add(uint32_t genID, const SkIRect& subset, const SkBitmap& r esult) { 108 bool SkBitmapCache::Add(uint32_t genID, const SkIRect& subset, const SkBitmap& r esult) {
117 SkASSERT(result.isImmutable()); 109 SkASSERT(result.isImmutable());
118 110
119 if (subset.isEmpty() 111 if (subset.isEmpty()
120 || subset.top() < 0 112 || subset.top() < 0
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 151 }
160 return result; 152 return result;
161 } 153 }
162 154
163 void SkMipMapCache::Add(const SkBitmap& src, const SkMipMap* result) { 155 void SkMipMapCache::Add(const SkBitmap& src, const SkMipMap* result) {
164 if (result) { 156 if (result) {
165 SkResourceCache::Add(SkNEW_ARGS(MipMapRec, (src, result))); 157 SkResourceCache::Add(SkNEW_ARGS(MipMapRec, (src, result)));
166 } 158 }
167 } 159 }
168 160
OLDNEW
« no previous file with comments | « src/core/SkBitmapCache.h ('k') | src/lazy/SkCachingPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698