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

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

Issue 356513003: Step towards variable length effect keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak comment Created 6 years, 5 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 "GrDitherEffect.h" 8 #include "GrDitherEffect.h"
9 9
10 #include "gl/GrGLEffect.h" 10 #include "gl/GrGLEffect.h"
11 #include "gl/GrGLShaderBuilder.h"
11 #include "gl/GrGLSL.h" 12 #include "gl/GrGLSL.h"
12 #include "GrTBackendEffectFactory.h" 13 #include "GrTBackendEffectFactory.h"
13 14
14 #include "SkRect.h" 15 #include "SkRect.h"
15 16
16 ////////////////////////////////////////////////////////////////////////////// 17 //////////////////////////////////////////////////////////////////////////////
17 18
18 class GLDitherEffect; 19 class GLDitherEffect;
19 20
20 class DitherEffect : public GrEffect { 21 class DitherEffect : public GrEffect {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 builder->fsCodeAppendf("\t\tfloat r = " 106 builder->fsCodeAppendf("\t\tfloat r = "
106 "fract(sin(dot(%s.xy ,vec2(12.9898,78.233))) * 43758. 5453);\n", 107 "fract(sin(dot(%s.xy ,vec2(12.9898,78.233))) * 43758. 5453);\n",
107 builder->fragmentPosition()); 108 builder->fragmentPosition());
108 builder->fsCodeAppendf("\t\t%s = (1.0/255.0) * vec4(r, r, r, r) + %s;\n", 109 builder->fsCodeAppendf("\t\t%s = (1.0/255.0) * vec4(r, r, r, r) + %s;\n",
109 outputColor, GrGLSLExpr4(inputColor).c_str()); 110 outputColor, GrGLSLExpr4(inputColor).c_str());
110 } 111 }
111 112
112 ////////////////////////////////////////////////////////////////////////////// 113 //////////////////////////////////////////////////////////////////////////////
113 114
114 GrEffect* GrDitherEffect::Create() { return DitherEffect::Create(); } 115 GrEffect* GrDitherEffect::Create() { return DitherEffect::Create(); }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698