Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/effects/SkBlurMaskFilter.cpp

Issue 109823012: Pass ctm when performing image filtering in GPU backend. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rob's comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkMaskFilter.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 20 matching lines...) Expand all
31 virtual SkMask::Format getFormat() const SK_OVERRIDE; 31 virtual SkMask::Format getFormat() const SK_OVERRIDE;
32 virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&, 32 virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
33 SkIPoint* margin) const SK_OVERRIDE; 33 SkIPoint* margin) const SK_OVERRIDE;
34 34
35 #if SK_SUPPORT_GPU 35 #if SK_SUPPORT_GPU
36 virtual bool canFilterMaskGPU(const SkRect& devBounds, 36 virtual bool canFilterMaskGPU(const SkRect& devBounds,
37 const SkIRect& clipBounds, 37 const SkIRect& clipBounds,
38 const SkMatrix& ctm, 38 const SkMatrix& ctm,
39 SkRect* maskRect) const SK_OVERRIDE; 39 SkRect* maskRect) const SK_OVERRIDE;
40 virtual bool filterMaskGPU(GrTexture* src, 40 virtual bool filterMaskGPU(GrTexture* src,
41 const SkMatrix& ctm,
41 const SkRect& maskRect, 42 const SkRect& maskRect,
42 GrTexture** result, 43 GrTexture** result,
43 bool canOverwriteSrc) const; 44 bool canOverwriteSrc) const SK_OVERRIDE;
44 #endif 45 #endif
45 46
46 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; 47 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
47 48
48 SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;) 49 SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
49 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl) 50 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl)
50 51
51 protected: 52 protected:
52 virtual FilterReturn filterRectsToNine(const SkRect[], int count, const SkMa trix&, 53 virtual FilterReturn filterRectsToNine(const SkRect[], int count, const SkMa trix&,
53 const SkIRect& clipBounds, 54 const SkIRect& clipBounds,
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 534
534 // Outset srcRect and clipRect by 3 * sigma, to compute affected blur area. 535 // Outset srcRect and clipRect by 3 * sigma, to compute affected blur area.
535 srcRect.outset(sigma3, sigma3); 536 srcRect.outset(sigma3, sigma3);
536 clipRect.outset(sigma3, sigma3); 537 clipRect.outset(sigma3, sigma3);
537 srcRect.intersect(clipRect); 538 srcRect.intersect(clipRect);
538 *maskRect = srcRect; 539 *maskRect = srcRect;
539 return true; 540 return true;
540 } 541 }
541 542
542 bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, 543 bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
544 const SkMatrix& matrix,
543 const SkRect& maskRect, 545 const SkRect& maskRect,
544 GrTexture** result, 546 GrTexture** result,
545 bool canOverwriteSrc) const { 547 bool canOverwriteSrc) const {
546 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); 548 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height());
547 549
548 GrContext* context = src->getContext(); 550 GrContext* context = src->getContext();
549 551
550 GrContext::AutoWideOpenIdentityDraw awo(context, NULL); 552 GrContext::AutoWideOpenIdentityDraw awo(context, NULL);
551 553
554 // FIXME: This isn't the right matrix.
552 SkScalar xformedSigma = this->computeXformedSigma(context->getMatrix()); 555 SkScalar xformedSigma = this->computeXformedSigma(context->getMatrix());
553 SkASSERT(xformedSigma > 0); 556 SkASSERT(xformedSigma > 0);
554 557
555 // If we're doing a normal blur, we can clobber the pathTexture in the 558 // If we're doing a normal blur, we can clobber the pathTexture in the
556 // gaussianBlur. Otherwise, we need to save it for later compositing. 559 // gaussianBlur. Otherwise, we need to save it for later compositing.
557 bool isNormalBlur = (SkBlurMaskFilter::kNormal_BlurStyle == fBlurStyle); 560 bool isNormalBlur = (SkBlurMaskFilter::kNormal_BlurStyle == fBlurStyle);
558 *result = SkGpuBlurUtils::GaussianBlur(context, src, isNormalBlur && canOver writeSrc, 561 *result = SkGpuBlurUtils::GaussianBlur(context, src, isNormalBlur && canOver writeSrc,
559 clipRect, false, xformedSigma, xforme dSigma); 562 clipRect, false, xformedSigma, xforme dSigma);
560 if (NULL == *result) { 563 if (NULL == *result) {
561 return false; 564 return false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } else { 618 } else {
616 str->append("None"); 619 str->append("None");
617 } 620 }
618 str->append("))"); 621 str->append("))");
619 } 622 }
620 #endif 623 #endif
621 624
622 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 625 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
623 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 626 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
624 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 627 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkMaskFilter.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698