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

Side by Side Diff: src/effects/SkColorCubeFilter.cpp

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove default template arg Created 5 years, 11 months 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
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/gpu/GrCacheID.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 pdman.set1f(fColorCubeSizeUni, SkScalarToFloat(size)); 335 pdman.set1f(fColorCubeSizeUni, SkScalarToFloat(size));
336 pdman.set1f(fColorCubeInvSizeUni, SkScalarToFloat(SkScalarInvert(size))); 336 pdman.set1f(fColorCubeInvSizeUni, SkScalarToFloat(SkScalarInvert(size)));
337 } 337 }
338 338
339 void GrColorCubeEffect::GLProcessor::GenKey(const GrProcessor& proc, 339 void GrColorCubeEffect::GLProcessor::GenKey(const GrProcessor& proc,
340 const GrGLCaps&, GrProcessorKeyBuild er* b) { 340 const GrGLCaps&, GrProcessorKeyBuild er* b) {
341 b->add32(1); // Always same shader for now 341 b->add32(1); // Always same shader for now
342 } 342 }
343 343
344 GrFragmentProcessor* SkColorCubeFilter::asFragmentProcessor(GrContext* context) const { 344 GrFragmentProcessor* SkColorCubeFilter::asFragmentProcessor(GrContext* context) const {
345 static const GrCacheID::Domain gCubeDomain = GrCacheID::GenerateDomain(); 345 static const GrContentKey::Domain kDomain = GrContentKey::GenerateDomain();
346 346 GrContentKey key;
347 GrCacheID::Key key; 347 GrContentKey::Builder builder(&key, kDomain, 2);
348 key.fData32[0] = fUniqueID; 348 builder[0] = fUniqueID;
349 key.fData32[1] = fCache.cubeDimension(); 349 builder[1] = fCache.cubeDimension();
350 key.fData64[1] = 0; 350 builder.finish();
351 GrCacheID cacheID(gCubeDomain, key);
352 351
353 GrSurfaceDesc desc; 352 GrSurfaceDesc desc;
354 desc.fWidth = fCache.cubeDimension(); 353 desc.fWidth = fCache.cubeDimension();
355 desc.fHeight = fCache.cubeDimension() * fCache.cubeDimension(); 354 desc.fHeight = fCache.cubeDimension() * fCache.cubeDimension();
356 desc.fConfig = kRGBA_8888_GrPixelConfig; 355 desc.fConfig = kRGBA_8888_GrPixelConfig;
357 356
358 GrResourceKey rkey = GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc , cacheID); 357 GrSurface* surface = static_cast<GrSurface*>(context->findAndRefCachedResour ce(key));
359 GrSurface* surface = static_cast<GrSurface*>(context->findAndRefCachedResour ce(rkey));
360 SkAutoTUnref<GrTexture> textureCube; 358 SkAutoTUnref<GrTexture> textureCube;
361 if (surface) { 359 if (surface) {
362 textureCube.reset(surface->asTexture()); 360 textureCube.reset(surface->asTexture());
363 } else { 361 } else {
364 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData- >data(), 0)); 362 textureCube.reset(context->createTexture(NULL, desc, key, fCubeData->dat a(), 0));
365 } 363 }
366 364
367 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; 365 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL;
368 } 366 }
369 #endif 367 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/gpu/GrCacheID.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698