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

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

Issue 189663012: plumb API for analytic rrect blur (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 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
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 9
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 } 742 }
743 743
744 bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, 744 bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src,
745 SkScalar radius, Style style, 745 SkScalar radius, Style style,
746 SkIPoint *margin, SkMask::CreateMode createMode) { 746 SkIPoint *margin, SkMask::CreateMode createMode) {
747 return SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(radius), 747 return SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(radius),
748 dst, src, 748 dst, src,
749 style, margin, createMode); 749 style, margin, createMode);
750 } 750 }
751 751
752 bool SkBlurMask::BlurRRect(SkMask *dst, const SkRRect &src,
753 SkScalar radius, Style style,
754 SkIPoint *margin, SkMask::CreateMode createMode) {
755
756 return SkBlurMask::BlurRRect(SkBlurMask::ConvertRadiusToSigma(radius),
757 dst, src,
758 style, margin, createMode);
759 }
760
761
752 bool SkBlurMask::BlurRect(SkScalar sigma, SkMask *dst, 762 bool SkBlurMask::BlurRect(SkScalar sigma, SkMask *dst,
753 const SkRect &src, Style style, 763 const SkRect &src, Style style,
754 SkIPoint *margin, SkMask::CreateMode createMode) { 764 SkIPoint *margin, SkMask::CreateMode createMode) {
755 int profile_size = SkScalarCeilToInt(6*sigma); 765 int profile_size = SkScalarCeilToInt(6*sigma);
756 766
757 int pad = profile_size/2; 767 int pad = profile_size/2;
758 if (margin) { 768 if (margin) {
759 margin->set( pad, pad ); 769 margin->set( pad, pad );
760 } 770 }
761 771
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 uint8_t *dst_scanline = dp + y*dstWidth + pad; 853 uint8_t *dst_scanline = dp + y*dstWidth + pad;
844 memset(dst_scanline, 0xff, sw); 854 memset(dst_scanline, 0xff, sw);
845 } 855 }
846 } 856 }
847 // normal and solid styles are the same for analytic rect blurs, so don't 857 // normal and solid styles are the same for analytic rect blurs, so don't
848 // need to handle solid specially. 858 // need to handle solid specially.
849 859
850 return true; 860 return true;
851 } 861 }
852 862
863 bool SkBlurMask::BlurRRect(SkScalar sigma, SkMask *dst,
864 const SkRRect &src, Style style,
865 SkIPoint *margin, SkMask::CreateMode createMode) {
866 // Temporary for now -- always fail, should cause caller to fall back
867 // to old path. Plumbing just to land API and parallelize effort.
868
869 return false;
870 }
871
853 bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar radius , 872 bool SkBlurMask::BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar radius ,
854 Style style, SkIPoint* margin) { 873 Style style, SkIPoint* margin) {
855 return BlurGroundTruth(ConvertRadiusToSigma(radius), dst, src, style, margin ); 874 return BlurGroundTruth(ConvertRadiusToSigma(radius), dst, src, style, margin );
856 } 875 }
857 // The "simple" blur is a direct implementation of separable convolution with a discrete 876 // The "simple" blur is a direct implementation of separable convolution with a discrete
858 // gaussian kernel. It's "ground truth" in a sense; too slow to be used, but ve ry 877 // gaussian kernel. It's "ground truth" in a sense; too slow to be used, but ve ry
859 // useful for correctness comparisons. 878 // useful for correctness comparisons.
860 879
861 bool SkBlurMask::BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src, 880 bool SkBlurMask::BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src,
862 Style style, SkIPoint* margin) { 881 Style style, SkIPoint* margin) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 (void)autoCall.detach(); 1013 (void)autoCall.detach();
995 } 1014 }
996 1015
997 if (style == kInner_Style) { 1016 if (style == kInner_Style) {
998 dst->fBounds = src.fBounds; // restore trimmed bounds 1017 dst->fBounds = src.fBounds; // restore trimmed bounds
999 dst->fRowBytes = src.fRowBytes; 1018 dst->fRowBytes = src.fRowBytes;
1000 } 1019 }
1001 1020
1002 return true; 1021 return true;
1003 } 1022 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698