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

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

Issue 654313002: Auto-compare GrProcessors' texture accesses in isEqual(). (Closed) Base URL: https://skia.googlesource.com/skia.git@xformcomp
Patch Set: update Created 6 years, 2 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/SkArithmeticMode.cpp ('k') | src/effects/SkDisplacementMapEffect.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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; 225 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
226 226
227 private: 227 private:
228 GrGLProgramDataManager::UniformHandle fColorCubeSizeUni; 228 GrGLProgramDataManager::UniformHandle fColorCubeSizeUni;
229 GrGLProgramDataManager::UniformHandle fColorCubeInvSizeUni; 229 GrGLProgramDataManager::UniformHandle fColorCubeInvSizeUni;
230 230
231 typedef GrGLFragmentProcessor INHERITED; 231 typedef GrGLFragmentProcessor INHERITED;
232 }; 232 };
233 233
234 private: 234 private:
235 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; 235 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { retur n true; }
236 236
237 GrColorCubeEffect(GrTexture* colorCube); 237 GrColorCubeEffect(GrTexture* colorCube);
238 238
239 GrCoordTransform fColorCubeTransform; 239 GrCoordTransform fColorCubeTransform;
240 GrTextureAccess fColorCubeAccess; 240 GrTextureAccess fColorCubeAccess;
241 241
242 typedef GrFragmentProcessor INHERITED; 242 typedef GrFragmentProcessor INHERITED;
243 }; 243 };
244 244
245 /////////////////////////////////////////////////////////////////////////////// 245 ///////////////////////////////////////////////////////////////////////////////
246 246
247 GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube) 247 GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube)
248 : fColorCubeTransform(kLocal_GrCoordSet, colorCube) 248 : fColorCubeTransform(kLocal_GrCoordSet, colorCube)
249 , fColorCubeAccess(colorCube, "bgra", GrTextureParams::kBilerp_FilterMode) { 249 , fColorCubeAccess(colorCube, "bgra", GrTextureParams::kBilerp_FilterMode) {
250 this->addCoordTransform(&fColorCubeTransform); 250 this->addCoordTransform(&fColorCubeTransform);
251 this->addTextureAccess(&fColorCubeAccess); 251 this->addTextureAccess(&fColorCubeAccess);
252 } 252 }
253 253
254 GrColorCubeEffect::~GrColorCubeEffect() { 254 GrColorCubeEffect::~GrColorCubeEffect() {
255 } 255 }
256 256
257 bool GrColorCubeEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
258 const GrColorCubeEffect& s = sBase.cast<GrColorCubeEffect>();
259 return fColorCubeAccess.getTexture() == s.fColorCubeAccess.getTexture();
260 }
261
262 const GrBackendFragmentProcessorFactory& GrColorCubeEffect::getFactory() const { 257 const GrBackendFragmentProcessorFactory& GrColorCubeEffect::getFactory() const {
263 return GrTBackendFragmentProcessorFactory<GrColorCubeEffect>::getInstance(); 258 return GrTBackendFragmentProcessorFactory<GrColorCubeEffect>::getInstance();
264 } 259 }
265 260
266 void GrColorCubeEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 261 void GrColorCubeEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
267 inout->setToUnknown(); 262 inout->setToUnknown();
268 } 263 }
269 264
270 /////////////////////////////////////////////////////////////////////////////// 265 ///////////////////////////////////////////////////////////////////////////////
271 266
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 static_cast<GrTexture*>(context->findAndRefCachedResource( 360 static_cast<GrTexture*>(context->findAndRefCachedResource(
366 GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc, cacheID)))) ; 361 GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc, cacheID)))) ;
367 362
368 if (!textureCube) { 363 if (!textureCube) {
369 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData- >data(), 0)); 364 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData- >data(), 0));
370 } 365 }
371 366
372 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; 367 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL;
373 } 368 }
374 #endif 369 #endif
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698