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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 // If you want the immutable bitmap with the same ID as our cacherator, call try LockAsBitmap() | 84 // If you want the immutable bitmap with the same ID as our cacherator, call try LockAsBitmap() |
85 // | 85 // |
86 bool SkImageCacherator::generateBitmap(SkBitmap* bitmap) { | 86 bool SkImageCacherator::generateBitmap(SkBitmap* bitmap) { |
87 SkBitmap::Allocator* allocator = SkResourceCache::GetAllocator(); | 87 SkBitmap::Allocator* allocator = SkResourceCache::GetAllocator(); |
88 | 88 |
89 ScopedGenerator generator(this); | 89 ScopedGenerator generator(this); |
90 const SkImageInfo& genInfo = generator->getInfo(); | 90 const SkImageInfo& genInfo = generator->getInfo(); |
91 if (fInfo.dimensions() == genInfo.dimensions()) { | 91 if (fInfo.dimensions() == genInfo.dimensions()) { |
92 SkASSERT(fOrigin.x() == 0 && fOrigin.y() == 0); | 92 SkASSERT(fOrigin.x() == 0 && fOrigin.y() == 0); |
93 // fast-case, no copy needed | 93 // fast-case, no copy needed |
94 return generator->tryGenerateBitmap(bitmap, fInfo, allocator); | 94 return generator->tryGenerateBitmap(bitmap, genInfo, allocator); |
aleksandar.stojiljkovic
2015/12/07 19:31:02
fInfo is constructed based on initial generator->g
| |
95 } else { | 95 } else { |
96 // need to handle subsetting, so we first generate the full size version , and then | 96 // need to handle subsetting, so we first generate the full size version , and then |
97 // "read" from it to get our subset. See https://bug.skia.org/4213 | 97 // "read" from it to get our subset. See https://bug.skia.org/4213 |
98 | 98 |
99 SkBitmap full; | 99 SkBitmap full; |
100 if (!generator->tryGenerateBitmap(&full, genInfo, allocator)) { | 100 if (!generator->tryGenerateBitmap(&full, genInfo, allocator)) { |
101 return false; | 101 return false; |
102 } | 102 } |
103 if (!bitmap->tryAllocPixels(fInfo, nullptr, full.getColorTable())) { | 103 if (!bitmap->tryAllocPixels(fInfo, nullptr, full.getColorTable())) { |
104 return false; | 104 return false; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 } | 325 } |
326 | 326 |
327 #else | 327 #else |
328 | 328 |
329 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&, | 329 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&, |
330 const SkImage* client) { | 330 const SkImage* client) { |
331 return nullptr; | 331 return nullptr; |
332 } | 332 } |
333 | 333 |
334 #endif | 334 #endif |
OLD | NEW |