| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 #define __STDC_LIMIT_MACROS | 7 #define __STDC_LIMIT_MACROS |
| 8 | 8 |
| 9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
| 10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 | 901 |
| 902 void SkDraw::drawDevMask(const SkMask& srcM, const SkPaint& paint) const { | 902 void SkDraw::drawDevMask(const SkMask& srcM, const SkPaint& paint) const { |
| 903 if (srcM.fBounds.isEmpty()) { | 903 if (srcM.fBounds.isEmpty()) { |
| 904 return; | 904 return; |
| 905 } | 905 } |
| 906 | 906 |
| 907 const SkMask* mask = &srcM; | 907 const SkMask* mask = &srcM; |
| 908 | 908 |
| 909 SkMask dstM; | 909 SkMask dstM; |
| 910 if (paint.getMaskFilter() && | 910 if (paint.getMaskFilter() && |
| 911 paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, nullptr)) { | 911 paint.getMaskFilter()->filterMask(&dstM, srcM, *fMatrix, nullptr)) { |
| 912 mask = &dstM; | 912 mask = &dstM; |
| 913 } else { | |
| 914 dstM.fImage = nullptr; | |
| 915 } | 913 } |
| 916 SkAutoMaskFreeImage ami(dstM.fImage); | 914 SkAutoMaskFreeImage ami(dstM.fImage); |
| 917 | 915 |
| 918 SkAutoBlitterChoose blitterChooser(fDst, *fMatrix, paint); | 916 SkAutoBlitterChoose blitterChooser(fDst, *fMatrix, paint); |
| 919 SkBlitter* blitter = blitterChooser.get(); | 917 SkBlitter* blitter = blitterChooser.get(); |
| 920 | 918 |
| 921 SkAAClipBlitterWrapper wrapper; | 919 SkAAClipBlitterWrapper wrapper; |
| 922 const SkRegion* clipRgn; | 920 const SkRegion* clipRgn; |
| 923 | 921 |
| 924 if (fRC->isBW()) { | 922 if (fRC->isBW()) { |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 *bounds = devPath.getBounds().makeOutset(SK_ScalarHalf, SK_ScalarHalf).round
Out(); | 2004 *bounds = devPath.getBounds().makeOutset(SK_ScalarHalf, SK_ScalarHalf).round
Out(); |
| 2007 | 2005 |
| 2008 SkIPoint margin = SkIPoint::Make(0, 0); | 2006 SkIPoint margin = SkIPoint::Make(0, 0); |
| 2009 if (filter) { | 2007 if (filter) { |
| 2010 SkASSERT(filterMatrix); | 2008 SkASSERT(filterMatrix); |
| 2011 | 2009 |
| 2012 SkMask srcM, dstM; | 2010 SkMask srcM, dstM; |
| 2013 | 2011 |
| 2014 srcM.fBounds = *bounds; | 2012 srcM.fBounds = *bounds; |
| 2015 srcM.fFormat = SkMask::kA8_Format; | 2013 srcM.fFormat = SkMask::kA8_Format; |
| 2016 srcM.fImage = nullptr; | |
| 2017 if (!filter->filterMask(&dstM, srcM, *filterMatrix, &margin)) { | 2014 if (!filter->filterMask(&dstM, srcM, *filterMatrix, &margin)) { |
| 2018 return false; | 2015 return false; |
| 2019 } | 2016 } |
| 2020 } | 2017 } |
| 2021 | 2018 |
| 2022 // (possibly) trim the bounds to reflect the clip | 2019 // (possibly) trim the bounds to reflect the clip |
| 2023 // (plus whatever slop the filter needs) | 2020 // (plus whatever slop the filter needs) |
| 2024 if (clipBounds) { | 2021 if (clipBounds) { |
| 2025 // Ugh. Guard against gigantic margins from wacky filters. Without this | 2022 // Ugh. Guard against gigantic margins from wacky filters. Without this |
| 2026 // check we can request arbitrary amounts of slop beyond our visible | 2023 // check we can request arbitrary amounts of slop beyond our visible |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 mask->fImage = SkMask::AllocImage(size); | 2077 mask->fImage = SkMask::AllocImage(size); |
| 2081 memset(mask->fImage, 0, mask->computeImageSize()); | 2078 memset(mask->fImage, 0, mask->computeImageSize()); |
| 2082 } | 2079 } |
| 2083 | 2080 |
| 2084 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2081 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
| 2085 draw_into_mask(*mask, devPath, style); | 2082 draw_into_mask(*mask, devPath, style); |
| 2086 } | 2083 } |
| 2087 | 2084 |
| 2088 return true; | 2085 return true; |
| 2089 } | 2086 } |
| OLD | NEW |