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

Side by Side Diff: src/effects/SkAlphaThresholdFilter.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/core/SkXfermode.cpp ('k') | src/effects/SkArithmeticMode.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 "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 SkScalar innerThreshold, 42 SkScalar innerThreshold,
43 SkScalar outerThreshold, 43 SkScalar outerThreshold,
44 SkImageFilter* input) { 44 SkImageFilter* input) {
45 return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outer Threshold, input)); 45 return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outer Threshold, input));
46 } 46 }
47 47
48 #if SK_SUPPORT_GPU 48 #if SK_SUPPORT_GPU
49 #include "GrContext.h" 49 #include "GrContext.h"
50 #include "GrCoordTransform.h" 50 #include "GrCoordTransform.h"
51 #include "GrFragmentProcessor.h" 51 #include "GrFragmentProcessor.h"
52 #include "GrInvariantOutput.h"
52 #include "gl/GrGLProcessor.h" 53 #include "gl/GrGLProcessor.h"
53 #include "gl/builders/GrGLProgramBuilder.h" 54 #include "gl/builders/GrGLProgramBuilder.h"
54 #include "GrTBackendProcessorFactory.h" 55 #include "GrTBackendProcessorFactory.h"
55 #include "GrTextureAccess.h" 56 #include "GrTextureAccess.h"
56 57
57 #include "SkGr.h" 58 #include "SkGr.h"
58 59
59 class GrGLAlphaThresholdEffect; 60 class GrGLAlphaThresholdEffect;
60 61
61 class AlphaThresholdEffect : public GrFragmentProcessor { 62 class AlphaThresholdEffect : public GrFragmentProcessor {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 GrCoordTransform::MakeDivByTextureWHMatrix(maskTex ture), maskTexture) 96 GrCoordTransform::MakeDivByTextureWHMatrix(maskTex ture), maskTexture)
96 , fMaskTextureAccess(maskTexture) { 97 , fMaskTextureAccess(maskTexture) {
97 this->addCoordTransform(&fImageCoordTransform); 98 this->addCoordTransform(&fImageCoordTransform);
98 this->addTextureAccess(&fImageTextureAccess); 99 this->addTextureAccess(&fImageTextureAccess);
99 this->addCoordTransform(&fMaskCoordTransform); 100 this->addCoordTransform(&fMaskCoordTransform);
100 this->addTextureAccess(&fMaskTextureAccess); 101 this->addTextureAccess(&fMaskTextureAccess);
101 } 102 }
102 103
103 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; 104 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
104 105
105 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 106 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE;
106 107
107 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 108 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
108 109
109 float fInnerThreshold; 110 float fInnerThreshold;
110 float fOuterThreshold; 111 float fOuterThreshold;
111 GrCoordTransform fImageCoordTransform; 112 GrCoordTransform fImageCoordTransform;
112 GrTextureAccess fImageTextureAccess; 113 GrTextureAccess fImageTextureAccess;
113 GrCoordTransform fMaskCoordTransform; 114 GrCoordTransform fMaskCoordTransform;
114 GrTextureAccess fMaskTextureAccess; 115 GrTextureAccess fMaskTextureAccess;
115 116
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 const GrBackendFragmentProcessorFactory& AlphaThresholdEffect::getFactory() cons t { 221 const GrBackendFragmentProcessorFactory& AlphaThresholdEffect::getFactory() cons t {
221 return GrTBackendFragmentProcessorFactory<AlphaThresholdEffect>::getInstance (); 222 return GrTBackendFragmentProcessorFactory<AlphaThresholdEffect>::getInstance ();
222 } 223 }
223 224
224 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 225 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
225 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>(); 226 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>();
226 return (this->fInnerThreshold == s.fInnerThreshold && 227 return (this->fInnerThreshold == s.fInnerThreshold &&
227 this->fOuterThreshold == s.fOuterThreshold); 228 this->fOuterThreshold == s.fOuterThreshold);
228 } 229 }
229 230
230 void AlphaThresholdEffect::onComputeInvariantOutput(InvariantOutput* inout) cons t { 231 void AlphaThresholdEffect::onComputeInvariantOutput(GrInvariantOutput* inout) co nst {
231 if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >= 1.f) { 232 if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >= 1.f) {
232 inout->mulByUnknownOpaqueColor(); 233 inout->mulByUnknownOpaqueColor();
233 } else { 234 } else {
234 inout->mulByUnknownColor(); 235 inout->mulByUnknownColor();
235 } 236 }
236 } 237 }
237 238
238 #endif 239 #endif
239 240
240 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 241 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 (U8CPU)(SkColorGetG(source) * scale), 378 (U8CPU)(SkColorGetG(source) * scale),
378 (U8CPU)(SkColorGetB(source) * scale)); 379 (U8CPU)(SkColorGetB(source) * scale));
379 } 380 }
380 } 381 }
381 dptr[y * dst->width() + x] = output_color; 382 dptr[y * dst->width() + x] = output_color;
382 } 383 }
383 } 384 }
384 385
385 return true; 386 return true;
386 } 387 }
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698