| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrConvolutionEffect.h" | 8 #include "GrConvolutionEffect.h" |
| 9 #include "gl/GrGLEffect.h" | 9 #include "gl/GrGLEffect.h" |
| 10 #include "gl/GrGLSL.h" | 10 #include "gl/GrGLSL.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 float imageIncrement[2] = { 0 }; | 111 float imageIncrement[2] = { 0 }; |
| 112 float ySign = texture.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f; | 112 float ySign = texture.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f; |
| 113 switch (conv.direction()) { | 113 switch (conv.direction()) { |
| 114 case Gr1DKernelEffect::kX_Direction: | 114 case Gr1DKernelEffect::kX_Direction: |
| 115 imageIncrement[0] = 1.0f / texture.width(); | 115 imageIncrement[0] = 1.0f / texture.width(); |
| 116 break; | 116 break; |
| 117 case Gr1DKernelEffect::kY_Direction: | 117 case Gr1DKernelEffect::kY_Direction: |
| 118 imageIncrement[1] = ySign / texture.height(); | 118 imageIncrement[1] = ySign / texture.height(); |
| 119 break; | 119 break; |
| 120 default: | 120 default: |
| 121 GrCrash("Unknown filter direction."); | 121 SkFAIL("Unknown filter direction."); |
| 122 } | 122 } |
| 123 uman.set2fv(fImageIncrementUni, 1, imageIncrement); | 123 uman.set2fv(fImageIncrementUni, 1, imageIncrement); |
| 124 if (conv.useBounds()) { | 124 if (conv.useBounds()) { |
| 125 const float* bounds = conv.bounds(); | 125 const float* bounds = conv.bounds(); |
| 126 if (Gr1DKernelEffect::kY_Direction == conv.direction() && | 126 if (Gr1DKernelEffect::kY_Direction == conv.direction() && |
| 127 texture.origin() != kTopLeft_GrSurfaceOrigin) { | 127 texture.origin() != kTopLeft_GrSurfaceOrigin) { |
| 128 uman.set2f(fBoundsUni, 1.0f - bounds[1], 1.0f - bounds[0]); | 128 uman.set2f(fBoundsUni, 1.0f - bounds[1], 1.0f - bounds[0]); |
| 129 } else { | 129 } else { |
| 130 uman.set2f(fBoundsUni, bounds[0], bounds[1]); | 130 uman.set2f(fBoundsUni, bounds[0], bounds[1]); |
| 131 } | 131 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } | 229 } |
| 230 | 230 |
| 231 bool useBounds = random->nextBool(); | 231 bool useBounds = random->nextBool(); |
| 232 return GrConvolutionEffect::Create(textures[texIdx], | 232 return GrConvolutionEffect::Create(textures[texIdx], |
| 233 dir, | 233 dir, |
| 234 radius, | 234 radius, |
| 235 kernel, | 235 kernel, |
| 236 useBounds, | 236 useBounds, |
| 237 bounds); | 237 bounds); |
| 238 } | 238 } |
| OLD | NEW |