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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 m.coordsType(), | 463 m.coordsType(), |
464 m.texture(0)); | 464 m.texture(0)); |
465 return key | matrixKey; | 465 return key | matrixKey; |
466 } | 466 } |
467 | 467 |
468 void GrGLMatrixConvolutionEffect::setData(const GrGLUniformManager& uman, | 468 void GrGLMatrixConvolutionEffect::setData(const GrGLUniformManager& uman, |
469 const GrDrawEffect& drawEffect) { | 469 const GrDrawEffect& drawEffect) { |
470 const GrMatrixConvolutionEffect& conv = drawEffect.castEffect<GrMatrixConvol
utionEffect>(); | 470 const GrMatrixConvolutionEffect& conv = drawEffect.castEffect<GrMatrixConvol
utionEffect>(); |
471 GrTexture& texture = *conv.texture(0); | 471 GrTexture& texture = *conv.texture(0); |
472 // the code we generated was for a specific kernel size | 472 // the code we generated was for a specific kernel size |
473 GrAssert(conv.kernelSize() == fKernelSize); | 473 SkASSERT(conv.kernelSize() == fKernelSize); |
474 GrAssert(conv.tileMode() == fTileMode); | 474 SkASSERT(conv.tileMode() == fTileMode); |
475 float imageIncrement[2]; | 475 float imageIncrement[2]; |
476 float ySign = texture.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f; | 476 float ySign = texture.origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f; |
477 imageIncrement[0] = 1.0f / texture.width(); | 477 imageIncrement[0] = 1.0f / texture.width(); |
478 imageIncrement[1] = ySign / texture.height(); | 478 imageIncrement[1] = ySign / texture.height(); |
479 uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement); | 479 uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement); |
480 uman.set2fv(fTargetUni, 0, 1, conv.target()); | 480 uman.set2fv(fTargetUni, 0, 1, conv.target()); |
481 uman.set1fv(fKernelUni, 0, fKernelSize.width() * fKernelSize.height(), conv.
kernel()); | 481 uman.set1fv(fKernelUni, 0, fKernelSize.width() * fKernelSize.height(), conv.
kernel()); |
482 uman.set1f(fGainUni, conv.gain()); | 482 uman.set1f(fGainUni, conv.gain()); |
483 uman.set1f(fBiasUni, conv.bias()); | 483 uman.set1f(fBiasUni, conv.bias()); |
484 fEffectMatrix.setData(uman, | 484 fEffectMatrix.setData(uman, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 fBias, | 578 fBias, |
579 fTarget, | 579 fTarget, |
580 fTileMode, | 580 fTileMode, |
581 fConvolveAlpha); | 581 fConvolveAlpha); |
582 return true; | 582 return true; |
583 } | 583 } |
584 | 584 |
585 /////////////////////////////////////////////////////////////////////////////// | 585 /////////////////////////////////////////////////////////////////////////////// |
586 | 586 |
587 #endif | 587 #endif |
OLD | NEW |