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

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

Issue 2337803002: Don't copy image buffer when calculating size.
Patch Set: Updating tests. 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 int srcX, int srcY) { 120 int srcX, int srcY) {
121 ScopedGenerator generator(this); 121 ScopedGenerator generator(this);
122 const SkImageInfo& genInfo = generator->getInfo(); 122 const SkImageInfo& genInfo = generator->getInfo();
123 // Currently generators do not natively handle subsets, so check that first. 123 // Currently generators do not natively handle subsets, so check that first.
124 if (srcX || srcY || genInfo.width() != info.width() || genInfo.height() != i nfo.height()) { 124 if (srcX || srcY || genInfo.width() != info.width() || genInfo.height() != i nfo.height()) {
125 return false; 125 return false;
126 } 126 }
127 return generator->getPixels(info, pixels, rb); 127 return generator->getPixels(info, pixels, rb);
128 } 128 }
129 129
130 bool SkImageCacherator::canGenerateTexture(const GrContextThreadSafeProxy& proxy )
131 {
132 ScopedGenerator generator(this);
133 return generator->canGenerateTexture(proxy);
134 }
135
136
130 //////////////////////////////////////////////////////////////////////////////// ////////////////// 137 //////////////////////////////////////////////////////////////////////////////// //////////////////
131 138
132 bool SkImageCacherator::lockAsBitmapOnlyIfAlreadyCached(SkBitmap* bitmap) { 139 bool SkImageCacherator::lockAsBitmapOnlyIfAlreadyCached(SkBitmap* bitmap) {
133 return SkBitmapCache::Find(fUniqueID, bitmap) && check_output_bitmap(*bitmap , fUniqueID); 140 return SkBitmapCache::Find(fUniqueID, bitmap) && check_output_bitmap(*bitmap , fUniqueID);
134 } 141 }
135 142
136 bool SkImageCacherator::tryLockAsBitmap(SkBitmap* bitmap, const SkImage* client, 143 bool SkImageCacherator::tryLockAsBitmap(SkBitmap* bitmap, const SkImage* client,
137 SkImage::CachingHint chint) { 144 SkImage::CachingHint chint) {
138 if (this->lockAsBitmapOnlyIfAlreadyCached(bitmap)) { 145 if (this->lockAsBitmapOnlyIfAlreadyCached(bitmap)) {
139 return true; 146 return true;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 354
348 #else 355 #else
349 356
350 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&, 357 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&,
351 SkSourceGammaTreatment gammaTreatmen t, 358 SkSourceGammaTreatment gammaTreatmen t,
352 const SkImage* client, SkImage::Cach ingHint) { 359 const SkImage* client, SkImage::Cach ingHint) {
353 return nullptr; 360 return nullptr;
354 } 361 }
355 362
356 #endif 363 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageCacherator.h ('k') | src/image/SkImage_Base.h » ('j') | tests/ImageTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698