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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kCompressed_LockTextureP
ath, | 284 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kCompressed_LockTextureP
ath, |
285 kLockTexturePathCount); | 285 kLockTexturePathCount); |
286 return set_key_and_return(tex, key); | 286 return set_key_and_return(tex, key); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 // 4. Ask the generator to return YUV planes, which the GPU can convert | 290 // 4. Ask the generator to return YUV planes, which the GPU can convert |
291 { | 291 { |
292 ScopedGenerator generator(this); | 292 ScopedGenerator generator(this); |
293 Generator_GrYUVProvider provider(generator); | 293 Generator_GrYUVProvider provider(generator); |
294 GrTexture* tex = provider.refAsTexture(ctx, desc, true); | 294 sk_sp<GrTexture> tex = provider.refAsTexture(ctx, desc, true); |
295 if (tex) { | 295 if (tex) { |
296 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kYUV_LockTexturePath, | 296 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kYUV_LockTexturePath, |
297 kLockTexturePathCount); | 297 kLockTexturePathCount); |
298 return set_key_and_return(tex, key); | 298 return set_key_and_return(tex.release(), key); |
299 } | 299 } |
300 } | 300 } |
301 | 301 |
302 // 5. Ask the generator to return RGB(A) data, which the GPU can convert | 302 // 5. Ask the generator to return RGB(A) data, which the GPU can convert |
303 SkBitmap bitmap; | 303 SkBitmap bitmap; |
304 if (this->tryLockAsBitmap(&bitmap, client, chint)) { | 304 if (this->tryLockAsBitmap(&bitmap, client, chint)) { |
305 GrTexture* tex = nullptr; | 305 GrTexture* tex = nullptr; |
306 if (willBeMipped) { | 306 if (willBeMipped) { |
307 tex = GrGenerateMipMapsAndUploadToTexture(ctx, bitmap); | 307 tex = GrGenerateMipMapsAndUploadToTexture(ctx, bitmap); |
308 } | 308 } |
(...skipping 23 matching lines...) Expand all Loading... |
332 } | 332 } |
333 | 333 |
334 #else | 334 #else |
335 | 335 |
336 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam
s&, | 336 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam
s&, |
337 const SkImage* client, SkImage::Cach
ingHint) { | 337 const SkImage* client, SkImage::Cach
ingHint) { |
338 return nullptr; | 338 return nullptr; |
339 } | 339 } |
340 | 340 |
341 #endif | 341 #endif |
OLD | NEW |