| 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 kernel.get(), | 555 kernel.get(), |
| 556 gain, | 556 gain, |
| 557 bias, | 557 bias, |
| 558 target, | 558 target, |
| 559 tileMode, | 559 tileMode, |
| 560 convolveAlpha); | 560 convolveAlpha); |
| 561 } | 561 } |
| 562 | 562 |
| 563 bool SkMatrixConvolutionImageFilter::asNewEffect(GrEffectRef** effect, | 563 bool SkMatrixConvolutionImageFilter::asNewEffect(GrEffectRef** effect, |
| 564 GrTexture* texture) const { | 564 GrTexture* texture) const { |
| 565 bool ok = fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE; | 565 if (!effect) { |
| 566 if (ok && effect) { | 566 return fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE; |
| 567 *effect = GrMatrixConvolutionEffect::Create(texture, | |
| 568 fKernelSize, | |
| 569 fKernel, | |
| 570 fGain, | |
| 571 fBias, | |
| 572 fTarget, | |
| 573 fTileMode, | |
| 574 fConvolveAlpha); | |
| 575 } | 567 } |
| 576 return ok; | 568 SkASSERT(fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE); |
| 569 *effect = GrMatrixConvolutionEffect::Create(texture, |
| 570 fKernelSize, |
| 571 fKernel, |
| 572 fGain, |
| 573 fBias, |
| 574 fTarget, |
| 575 fTileMode, |
| 576 fConvolveAlpha); |
| 577 return true; |
| 577 } | 578 } |
| 578 | 579 |
| 579 /////////////////////////////////////////////////////////////////////////////// | 580 /////////////////////////////////////////////////////////////////////////////// |
| 580 | 581 |
| 581 #endif | 582 #endif |
| OLD | NEW |