| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |