| OLD | NEW |
| 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 Loading... |
| 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(); } |
| OLD | NEW |