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

Side by Side Diff: src/gpu/effects/GrDitherEffect.cpp

Issue 643743003: Create helper functions to use in computeInvariantOutput calls (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update blurMaskFilter 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
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 "gl/builders/GrGLProgramBuilder.h" 8 #include "gl/builders/GrGLProgramBuilder.h"
9 #include "GrDitherEffect.h" 9 #include "GrDitherEffect.h"
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; } 43 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; }
44 44
45 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 45 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE;
46 46
47 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 47 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
48 48
49 typedef GrFragmentProcessor INHERITED; 49 typedef GrFragmentProcessor INHERITED;
50 }; 50 };
51 51
52 void DitherEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 52 void DitherEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
53 inout->fValidFlags = 0; 53 inout->setToUnknown();
54 inout->fIsSingleComponent = false;
55 } 54 }
56 55
57 ////////////////////////////////////////////////////////////////////////////// 56 //////////////////////////////////////////////////////////////////////////////
58 57
59 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect); 58 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect);
60 59
61 GrFragmentProcessor* DitherEffect::TestCreate(SkRandom*, 60 GrFragmentProcessor* DitherEffect::TestCreate(SkRandom*,
62 GrContext*, 61 GrContext*,
63 const GrDrawTargetCaps&, 62 const GrDrawTargetCaps&,
64 GrTexture*[]) { 63 GrTexture*[]) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 fsBuilder->codeAppendf("\t\tfloat r = " 107 fsBuilder->codeAppendf("\t\tfloat r = "
109 "fract(sin(dot(%s.xy ,vec2(12.9898,78.233))) * 43758. 5453);\n", 108 "fract(sin(dot(%s.xy ,vec2(12.9898,78.233))) * 43758. 5453);\n",
110 fsBuilder->fragmentPosition()); 109 fsBuilder->fragmentPosition());
111 fsBuilder->codeAppendf("\t\t%s = (1.0/255.0) * vec4(r, r, r, r) + %s;\n", 110 fsBuilder->codeAppendf("\t\t%s = (1.0/255.0) * vec4(r, r, r, r) + %s;\n",
112 outputColor, GrGLSLExpr4(inputColor).c_str()); 111 outputColor, GrGLSLExpr4(inputColor).c_str());
113 } 112 }
114 113
115 ////////////////////////////////////////////////////////////////////////////// 114 //////////////////////////////////////////////////////////////////////////////
116 115
117 GrFragmentProcessor* GrDitherEffect::Create() { return DitherEffect::Create(); } 116 GrFragmentProcessor* GrDitherEffect::Create() { return DitherEffect::Create(); }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDistanceFieldTextureEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698