| 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 "SkMorphologyImageFilter.h" | 8 #include "SkMorphologyImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
| 12 #include "SkOpts.h" | 12 #include "SkOpts.h" |
| 13 #include "SkReadBuffer.h" | 13 #include "SkReadBuffer.h" |
| 14 #include "SkRect.h" | 14 #include "SkRect.h" |
| 15 #include "SkWriteBuffer.h" | 15 #include "SkWriteBuffer.h" |
| 16 #if SK_SUPPORT_GPU | 16 #if SK_SUPPORT_GPU |
| 17 #include "GrContext.h" | 17 #include "GrContext.h" |
| 18 #include "GrDrawContext.h" | 18 #include "GrDrawContext.h" |
| 19 #include "GrInvariantOutput.h" | 19 #include "GrInvariantOutput.h" |
| 20 #include "GrTexture.h" | 20 #include "GrTexture.h" |
| 21 #include "SkGr.h" |
| 21 #include "effects/Gr1DKernelEffect.h" | 22 #include "effects/Gr1DKernelEffect.h" |
| 22 #include "glsl/GrGLSLFragmentProcessor.h" | 23 #include "glsl/GrGLSLFragmentProcessor.h" |
| 23 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 24 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 24 #include "glsl/GrGLSLProgramDataManager.h" | 25 #include "glsl/GrGLSLProgramDataManager.h" |
| 25 #include "glsl/GrGLSLUniformHandler.h" | 26 #include "glsl/GrGLSLUniformHandler.h" |
| 26 #endif | 27 #endif |
| 27 | 28 |
| 28 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, | 29 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, |
| 29 int radiusY, | 30 int radiusY, |
| 30 SkImageFilter* input, | 31 SkImageFilter* input, |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 if (!dstDrawContext) { | 600 if (!dstDrawContext) { |
| 600 return false; | 601 return false; |
| 601 } | 602 } |
| 602 | 603 |
| 603 apply_morphology_pass(dstDrawContext, clip, srcTexture, | 604 apply_morphology_pass(dstDrawContext, clip, srcTexture, |
| 604 srcRect, dstRect, radius.fHeight, morphType, | 605 srcRect, dstRect, radius.fHeight, morphType, |
| 605 Gr1DKernelEffect::kY_Direction); | 606 Gr1DKernelEffect::kY_Direction); |
| 606 | 607 |
| 607 srcTexture.reset(scratch); | 608 srcTexture.reset(scratch); |
| 608 } | 609 } |
| 609 SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst); | 610 GrWrapTextureInBitmap(srcTexture, rect.width(), rect.height(), false, dst); |
| 610 return true; | 611 return true; |
| 611 } | 612 } |
| 612 | 613 |
| 613 }; | 614 }; |
| 614 | 615 |
| 615 bool SkMorphologyImageFilter::filterImageGPUGeneric(bool dilate, | 616 bool SkMorphologyImageFilter::filterImageGPUGeneric(bool dilate, |
| 616 Proxy* proxy, | 617 Proxy* proxy, |
| 617 const SkBitmap& src, | 618 const SkBitmap& src, |
| 618 const Context& ctx, | 619 const Context& ctx, |
| 619 SkBitmap* result, | 620 SkBitmap* result, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 SkBitmap* result, SkIPoint* offset) con
st { | 661 SkBitmap* result, SkIPoint* offset) con
st { |
| 661 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 662 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
| 662 } | 663 } |
| 663 | 664 |
| 664 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 665 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
| 665 SkBitmap* result, SkIPoint* offset) cons
t { | 666 SkBitmap* result, SkIPoint* offset) cons
t { |
| 666 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 667 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
| 667 } | 668 } |
| 668 | 669 |
| 669 #endif | 670 #endif |
| OLD | NEW |