OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkColorCubeFilter.h" | 8 #include "SkColorCubeFilter.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkOnce.h" | 10 #include "SkOnce.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 key.fData32[0] = fUniqueID; | 349 key.fData32[0] = fUniqueID; |
350 key.fData32[1] = fCache.cubeDimension(); | 350 key.fData32[1] = fCache.cubeDimension(); |
351 key.fData64[1] = 0; | 351 key.fData64[1] = 0; |
352 GrCacheID cacheID(gCubeDomain, key); | 352 GrCacheID cacheID(gCubeDomain, key); |
353 | 353 |
354 GrSurfaceDesc desc; | 354 GrSurfaceDesc desc; |
355 desc.fWidth = fCache.cubeDimension(); | 355 desc.fWidth = fCache.cubeDimension(); |
356 desc.fHeight = fCache.cubeDimension() * fCache.cubeDimension(); | 356 desc.fHeight = fCache.cubeDimension() * fCache.cubeDimension(); |
357 desc.fConfig = kRGBA_8888_GrPixelConfig; | 357 desc.fConfig = kRGBA_8888_GrPixelConfig; |
358 | 358 |
359 SkAutoTUnref<GrTexture> textureCube( | 359 GrResourceKey rkey = GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc
, cacheID); |
360 static_cast<GrTexture*>(context->findAndRefCachedResource( | 360 GrSurface* surface = static_cast<GrSurface*>(context->findAndRefCachedResour
ce(rkey)); |
361 GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc, cacheID))))
; | 361 SkAutoTUnref<GrTexture> textureCube; |
362 | 362 if (surface) { |
363 if (!textureCube) { | 363 textureCube.reset(surface->asTexture()); |
| 364 } else { |
364 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData-
>data(), 0)); | 365 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData-
>data(), 0)); |
365 } | 366 } |
366 | 367 |
367 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; | 368 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; |
368 } | 369 } |
369 #endif | 370 #endif |
OLD | NEW |