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

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

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup Created 6 years, 1 month 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/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurMaskFilter.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 2013 Google Inc. 2 * Copyright 2013 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 "SkArithmeticMode.h" 8 #include "SkArithmeticMode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
11 #include "SkWriteBuffer.h" 11 #include "SkWriteBuffer.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 #include "SkUnPreMultiply.h" 13 #include "SkUnPreMultiply.h"
14 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrCoordTransform.h" 16 #include "GrCoordTransform.h"
17 #include "GrInvariantOutput.h"
17 #include "gl/GrGLProcessor.h" 18 #include "gl/GrGLProcessor.h"
18 #include "gl/builders/GrGLProgramBuilder.h" 19 #include "gl/builders/GrGLProgramBuilder.h"
19 #include "GrTBackendProcessorFactory.h" 20 #include "GrTBackendProcessorFactory.h"
20 #endif 21 #endif
21 22
22 static const bool gUseUnpremul = false; 23 static const bool gUseUnpremul = false;
23 24
24 class SkArithmeticMode_scalar : public SkXfermode { 25 class SkArithmeticMode_scalar : public SkXfermode {
25 public: 26 public:
26 static SkArithmeticMode_scalar* Create(SkScalar k1, SkScalar k2, SkScalar k3 , SkScalar k4, 27 static SkArithmeticMode_scalar* Create(SkScalar k1, SkScalar k2, SkScalar k3 , SkScalar k4,
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 292
292 float k1() const { return fK1; } 293 float k1() const { return fK1; }
293 float k2() const { return fK2; } 294 float k2() const { return fK2; }
294 float k3() const { return fK3; } 295 float k3() const { return fK3; }
295 float k4() const { return fK4; } 296 float k4() const { return fK4; }
296 bool enforcePMColor() const { return fEnforcePMColor; } 297 bool enforcePMColor() const { return fEnforcePMColor; }
297 298
298 private: 299 private:
299 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; 300 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
300 301
301 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 302 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE;
302 303
303 GrArithmeticEffect(float k1, float k2, float k3, float k4, bool enforcePMCol or, 304 GrArithmeticEffect(float k1, float k2, float k3, float k4, bool enforcePMCol or,
304 GrTexture* background); 305 GrTexture* background);
305 float fK1, fK2, fK3, fK4; 306 float fK1, fK2, fK3, fK4;
306 bool fEnforcePMColor; 307 bool fEnforcePMColor;
307 GrCoordTransform fBackgroundTransform; 308 GrCoordTransform fBackgroundTransform;
308 GrTextureAccess fBackgroundAccess; 309 GrTextureAccess fBackgroundAccess;
309 310
310 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 311 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
311 typedef GrFragmentProcessor INHERITED; 312 typedef GrFragmentProcessor INHERITED;
(...skipping 24 matching lines...) Expand all
336 fK2 == s.fK2 && 337 fK2 == s.fK2 &&
337 fK3 == s.fK3 && 338 fK3 == s.fK3 &&
338 fK4 == s.fK4 && 339 fK4 == s.fK4 &&
339 fEnforcePMColor == s.fEnforcePMColor; 340 fEnforcePMColor == s.fEnforcePMColor;
340 } 341 }
341 342
342 const GrBackendFragmentProcessorFactory& GrArithmeticEffect::getFactory() const { 343 const GrBackendFragmentProcessorFactory& GrArithmeticEffect::getFactory() const {
343 return GrTBackendFragmentProcessorFactory<GrArithmeticEffect>::getInstance() ; 344 return GrTBackendFragmentProcessorFactory<GrArithmeticEffect>::getInstance() ;
344 } 345 }
345 346
346 void GrArithmeticEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 347 void GrArithmeticEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t {
347 // TODO: optimize this 348 // TODO: optimize this
348 inout->setToUnknown(InvariantOutput::kWill_ReadInput); 349 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
349 } 350 }
350 351
351 /////////////////////////////////////////////////////////////////////////////// 352 ///////////////////////////////////////////////////////////////////////////////
352 353
353 GrGLArithmeticEffect::GrGLArithmeticEffect(const GrBackendProcessorFactory& fact ory, 354 GrGLArithmeticEffect::GrGLArithmeticEffect(const GrBackendProcessorFactory& fact ory,
354 const GrProcessor&) 355 const GrProcessor&)
355 : INHERITED(factory), 356 : INHERITED(factory),
356 fEnforcePMColor(true) { 357 fEnforcePMColor(true) {
357 } 358 }
358 359
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 background); 452 background);
452 } 453 }
453 return true; 454 return true;
454 } 455 }
455 456
456 #endif 457 #endif
457 458
458 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 459 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
459 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 460 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
460 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 461 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698