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

Unified Diff: src/core/SkMaskFilter.cpp

Issue 48623006: Add ability to ninepatch blurred rounded rectangle (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Address nit (static function name) Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMaskFilter.cpp
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 9c367f946b552798447eb89eec20b3237f481afe..cd2571637749ac1f318ada65167ba7ab1aa0187e 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -12,6 +12,7 @@
#include "SkBounder.h"
#include "SkDraw.h"
#include "SkRasterClip.h"
+#include "SkRRect.h"
#include "SkTypes.h"
#if SK_SUPPORT_GPU
@@ -204,6 +205,26 @@ static int countNestedRects(const SkPath& path, SkRect rects[2]) {
return path.isRect(&rects[0]);
}
+bool SkMaskFilter::filterRRect(const SkRRect& devRRect, const SkMatrix& matrix,
+ const SkRasterClip& clip, SkBounder* bounder,
+ SkBlitter* blitter, SkPaint::Style style) const {
+ // Attempt to speed up drawing by creating a nine patch. If a nine patch
+ // cannot be used, return false to allow our caller to recover and perform
+ // the drawing another way.
+ NinePatch patch;
+ patch.fMask.fImage = NULL;
+ if (kTrue_FilterReturn != this->filterRRectToNine(devRRect, matrix,
+ clip.getBounds(),
+ &patch)) {
+ SkASSERT(NULL == patch.fMask.fImage);
+ return false;
+ }
+ draw_nine(patch.fMask, patch.fOuterRect, patch.fCenter, true, clip,
+ bounder, blitter);
+ SkMask::FreeImage(patch.fMask.fImage);
+ return true;
+}
+
bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
const SkRasterClip& clip, SkBounder* bounder,
SkBlitter* blitter, SkPaint::Style style) const {
@@ -267,6 +288,12 @@ bool SkMaskFilter::filterPath(const SkPath& devPath, const SkMatrix& matrix,
}
SkMaskFilter::FilterReturn
+SkMaskFilter::filterRRectToNine(const SkRRect&, const SkMatrix&,
+ const SkIRect& clipBounds, NinePatch*) const {
+ return kUnimplemented_FilterReturn;
+}
+
+SkMaskFilter::FilterReturn
SkMaskFilter::filterRectsToNine(const SkRect[], int count, const SkMatrix&,
const SkIRect& clipBounds, NinePatch*) const {
return kUnimplemented_FilterReturn;
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698