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

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

Issue 2337803002: Don't copy image buffer when calculating size.
Patch Set: When no CPU work is needed, returning 0 means test expectation is false (0 == false). Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkImage_Base.h" 10 #include "SkImage_Base.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 int srcX, int srcY) { 150 int srcX, int srcY) {
151 ScopedGenerator generator(fSharedGenerator); 151 ScopedGenerator generator(fSharedGenerator);
152 const SkImageInfo& genInfo = generator->getInfo(); 152 const SkImageInfo& genInfo = generator->getInfo();
153 // Currently generators do not natively handle subsets, so check that first. 153 // Currently generators do not natively handle subsets, so check that first.
154 if (srcX || srcY || genInfo.width() != info.width() || genInfo.height() != i nfo.height()) { 154 if (srcX || srcY || genInfo.width() != info.width() || genInfo.height() != i nfo.height()) {
155 return false; 155 return false;
156 } 156 }
157 return generator->getPixels(info, pixels, rb); 157 return generator->getPixels(info, pixels, rb);
158 } 158 }
159 159
160 bool SkImageCacherator::canGenerateTexture(const GrContextThreadSafeProxy& proxy )
161 {
162 ScopedGenerator generator(fSharedGenerator);
163 return generator->canGenerateTexture(proxy);
164 }
165
166
cblume 2016/11/16 01:07:16 I'll remove this second blank line. Not sure how t
160 //////////////////////////////////////////////////////////////////////////////// ////////////////// 167 //////////////////////////////////////////////////////////////////////////////// //////////////////
161 168
162 bool SkImageCacherator::lockAsBitmapOnlyIfAlreadyCached(SkBitmap* bitmap) { 169 bool SkImageCacherator::lockAsBitmapOnlyIfAlreadyCached(SkBitmap* bitmap) {
163 return SkBitmapCache::Find(fUniqueID, bitmap) && check_output_bitmap(*bitmap , fUniqueID); 170 return SkBitmapCache::Find(fUniqueID, bitmap) && check_output_bitmap(*bitmap , fUniqueID);
164 } 171 }
165 172
166 bool SkImageCacherator::tryLockAsBitmap(SkBitmap* bitmap, const SkImage* client, 173 bool SkImageCacherator::tryLockAsBitmap(SkBitmap* bitmap, const SkImage* client,
167 SkImage::CachingHint chint) { 174 SkImage::CachingHint chint) {
168 if (this->lockAsBitmapOnlyIfAlreadyCached(bitmap)) { 175 if (this->lockAsBitmapOnlyIfAlreadyCached(bitmap)) {
169 return true; 176 return true;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 383
377 #else 384 #else
378 385
379 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&, 386 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&,
380 SkDestinationSurfaceColorMode colorM ode, 387 SkDestinationSurfaceColorMode colorM ode,
381 const SkImage* client, SkImage::Cach ingHint) { 388 const SkImage* client, SkImage::Cach ingHint) {
382 return nullptr; 389 return nullptr;
383 } 390 }
384 391
385 #endif 392 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698