| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkMatrixConvolutionImageFilter.h" | 8 #include "SkMatrixConvolutionImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 float imageIncrement[2]; | 508 float imageIncrement[2]; |
| 509 float ySign = texture.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f; | 509 float ySign = texture.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f; |
| 510 imageIncrement[0] = 1.0f / texture.width(); | 510 imageIncrement[0] = 1.0f / texture.width(); |
| 511 imageIncrement[1] = ySign / texture.height(); | 511 imageIncrement[1] = ySign / texture.height(); |
| 512 uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement); | 512 uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement); |
| 513 uman.set2fv(fTargetUni, 0, 1, conv.target()); | 513 uman.set2fv(fTargetUni, 0, 1, conv.target()); |
| 514 uman.set1fv(fKernelUni, 0, fKernelSize.width() * fKernelSize.height(), conv.
kernel()); | 514 uman.set1fv(fKernelUni, 0, fKernelSize.width() * fKernelSize.height(), conv.
kernel()); |
| 515 uman.set1f(fGainUni, conv.gain()); | 515 uman.set1f(fGainUni, conv.gain()); |
| 516 uman.set1f(fBiasUni, conv.bias()); | 516 uman.set1f(fBiasUni, conv.bias()); |
| 517 const SkIRect& bounds = conv.bounds(); | 517 const SkIRect& bounds = conv.bounds(); |
| 518 uman.set4f(fBoundsUni, | 518 float left = (float) bounds.left() / texture.width(); |
| 519 (float) bounds.left() / texture.width(), | 519 float top = (float) bounds.top() / texture.height(); |
| 520 (float) bounds.top() / texture.height(), | 520 float right = (float) bounds.right() / texture.width(); |
| 521 (float) bounds.right() / texture.width(), | 521 float bottom = (float) bounds.bottom() / texture.height(); |
| 522 (float) bounds.bottom() / texture.height()); | 522 if (texture.origin() == kBottomLeft_GrSurfaceOrigin) { |
| 523 uman.set4f(fBoundsUni, left, 1.0f - bottom, right, 1.0f - top); |
| 524 } else { |
| 525 uman.set4f(fBoundsUni, left, top, right, bottom); |
| 526 } |
| 523 } | 527 } |
| 524 | 528 |
| 525 GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture, | 529 GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture, |
| 526 const SkIRect& bounds, | 530 const SkIRect& bounds, |
| 527 const SkISize& kernelSize, | 531 const SkISize& kernelSize, |
| 528 const SkScalar* kernel, | 532 const SkScalar* kernel, |
| 529 SkScalar gain, | 533 SkScalar gain, |
| 530 SkScalar bias, | 534 SkScalar bias, |
| 531 const SkIPoint& target, | 535 const SkIPoint& target, |
| 532 TileMode tileMode, | 536 TileMode tileMode, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 fBias, | 628 fBias, |
| 625 fTarget, | 629 fTarget, |
| 626 fTileMode, | 630 fTileMode, |
| 627 fConvolveAlpha); | 631 fConvolveAlpha); |
| 628 return true; | 632 return true; |
| 629 } | 633 } |
| 630 | 634 |
| 631 /////////////////////////////////////////////////////////////////////////////// | 635 /////////////////////////////////////////////////////////////////////////////// |
| 632 | 636 |
| 633 #endif | 637 #endif |
| OLD | NEW |