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

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

Issue 2337803002: Don't copy image buffer when calculating size.
Patch Set: Making SkImage_Gpu always return 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
« no previous file with comments | « src/core/SkImageCacherator.h ('k') | src/image/SkImage_Base.h » ('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 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
160 //////////////////////////////////////////////////////////////////////////////// ////////////////// 166 //////////////////////////////////////////////////////////////////////////////// //////////////////
161 167
162 bool SkImageCacherator::lockAsBitmapOnlyIfAlreadyCached(SkBitmap* bitmap) { 168 bool SkImageCacherator::lockAsBitmapOnlyIfAlreadyCached(SkBitmap* bitmap) {
163 return SkBitmapCache::Find(fUniqueID, bitmap) && check_output_bitmap(*bitmap , fUniqueID); 169 return SkBitmapCache::Find(fUniqueID, bitmap) && check_output_bitmap(*bitmap , fUniqueID);
164 } 170 }
165 171
166 bool SkImageCacherator::tryLockAsBitmap(SkBitmap* bitmap, const SkImage* client, 172 bool SkImageCacherator::tryLockAsBitmap(SkBitmap* bitmap, const SkImage* client,
167 SkImage::CachingHint chint) { 173 SkImage::CachingHint chint) {
168 if (this->lockAsBitmapOnlyIfAlreadyCached(bitmap)) { 174 if (this->lockAsBitmapOnlyIfAlreadyCached(bitmap)) {
169 return true; 175 return true;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 382
377 #else 383 #else
378 384
379 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&, 385 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&,
380 SkDestinationSurfaceColorMode colorM ode, 386 SkDestinationSurfaceColorMode colorM ode,
381 const SkImage* client, SkImage::Cach ingHint) { 387 const SkImage* client, SkImage::Cach ingHint) {
382 return nullptr; 388 return nullptr;
383 } 389 }
384 390
385 #endif 391 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageCacherator.h ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698