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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 const GrDrawEffect& drawEffect) { | 530 const GrDrawEffect& drawEffect) { |
531 const GrMatrixConvolutionEffect& conv = drawEffect.castEffect<GrMatrixConvol
utionEffect>(); | 531 const GrMatrixConvolutionEffect& conv = drawEffect.castEffect<GrMatrixConvol
utionEffect>(); |
532 GrTexture& texture = *conv.texture(0); | 532 GrTexture& texture = *conv.texture(0); |
533 // the code we generated was for a specific kernel size | 533 // the code we generated was for a specific kernel size |
534 SkASSERT(conv.kernelSize() == fKernelSize); | 534 SkASSERT(conv.kernelSize() == fKernelSize); |
535 SkASSERT(conv.tileMode() == fTileMode); | 535 SkASSERT(conv.tileMode() == fTileMode); |
536 float imageIncrement[2]; | 536 float imageIncrement[2]; |
537 float ySign = texture.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f; | 537 float ySign = texture.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f; |
538 imageIncrement[0] = 1.0f / texture.width(); | 538 imageIncrement[0] = 1.0f / texture.width(); |
539 imageIncrement[1] = ySign / texture.height(); | 539 imageIncrement[1] = ySign / texture.height(); |
540 uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement); | 540 uman.set2fv(fImageIncrementUni, 1, imageIncrement); |
541 uman.set2fv(fTargetUni, 0, 1, conv.target()); | 541 uman.set2fv(fTargetUni, 1, conv.target()); |
542 uman.set1fv(fKernelUni, 0, fKernelSize.width() * fKernelSize.height(), conv.
kernel()); | 542 uman.set1fv(fKernelUni, fKernelSize.width() * fKernelSize.height(), conv.ker
nel()); |
543 uman.set1f(fGainUni, conv.gain()); | 543 uman.set1f(fGainUni, conv.gain()); |
544 uman.set1f(fBiasUni, conv.bias()); | 544 uman.set1f(fBiasUni, conv.bias()); |
545 const SkIRect& bounds = conv.bounds(); | 545 const SkIRect& bounds = conv.bounds(); |
546 float left = (float) bounds.left() / texture.width(); | 546 float left = (float) bounds.left() / texture.width(); |
547 float top = (float) bounds.top() / texture.height(); | 547 float top = (float) bounds.top() / texture.height(); |
548 float right = (float) bounds.right() / texture.width(); | 548 float right = (float) bounds.right() / texture.width(); |
549 float bottom = (float) bounds.bottom() / texture.height(); | 549 float bottom = (float) bounds.bottom() / texture.height(); |
550 if (texture.origin() == kBottomLeft_GrSurfaceOrigin) { | 550 if (texture.origin() == kBottomLeft_GrSurfaceOrigin) { |
551 uman.set4f(fBoundsUni, left, 1.0f - bottom, right, 1.0f - top); | 551 uman.set4f(fBoundsUni, left, 1.0f - bottom, right, 1.0f - top); |
552 } else { | 552 } else { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 fBias, | 657 fBias, |
658 fTarget, | 658 fTarget, |
659 fTileMode, | 659 fTileMode, |
660 fConvolveAlpha); | 660 fConvolveAlpha); |
661 return true; | 661 return true; |
662 } | 662 } |
663 | 663 |
664 /////////////////////////////////////////////////////////////////////////////// | 664 /////////////////////////////////////////////////////////////////////////////// |
665 | 665 |
666 #endif | 666 #endif |
OLD | NEW |