 Chromium Code Reviews
 Chromium Code Reviews Issue 48623006:
  Add ability to ninepatch blurred rounded rectangle  (Closed) 
  Base URL: https://skia.googlecode.com/svn/trunk
    
  
    Issue 48623006:
  Add ability to ninepatch blurred rounded rectangle  (Closed) 
  Base URL: https://skia.googlecode.com/svn/trunk| Index: src/core/SkDraw.cpp | 
| diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp | 
| index d2d618090e39d4e085bbf5cf8174721bbe990b93..87224700a53b3aec2b533f3b92e98ba06f799a5d 100644 | 
| --- a/src/core/SkDraw.cpp | 
| +++ b/src/core/SkDraw.cpp | 
| @@ -18,6 +18,7 @@ | 
| #include "SkPathEffect.h" | 
| #include "SkRasterClip.h" | 
| #include "SkRasterizer.h" | 
| +#include "SkRRect.h" | 
| #include "SkScan.h" | 
| #include "SkShader.h" | 
| #include "SkString.h" | 
| @@ -1022,6 +1023,52 @@ bool SkDrawTreatAsHairline(const SkPaint& paint, const SkMatrix& matrix, | 
| return false; | 
| } | 
| +void SkDraw::drawRRect(const SkRRect& rrect, const SkPaint& paint) const { | 
| + SkDEBUGCODE(this->validate()); | 
| + | 
| + if (fRC->isEmpty()) { | 
| + return; | 
| + } | 
| + | 
| + { | 
| + // TODO: Investigate optimizing these options. They are in the same | 
| + // order as SkDraw::drawPath, which handles each case. It may be | 
| + // that there is no way to optimize for these using the SkRRect path. | 
| + SkScalar coverage; | 
| + if (SkDrawTreatAsHairline(paint, *fMatrix, &coverage)) { | 
| + goto DRAW_PATH; | 
| + } | 
| + | 
| + if (paint.getPathEffect() | 
| 
robertphillips
2013/10/31 00:24:58
will this fit on the prior line?
 
scroggo
2013/11/01 21:45:46
It is 81 chars, so it falls within our hard limit
 | 
| + || paint.getStyle() != SkPaint::kFill_Style) { | 
| + goto DRAW_PATH; | 
| + } | 
| + | 
| + if (paint.getRasterizer()) { | 
| + goto DRAW_PATH; | 
| + } | 
| + } | 
| + | 
| + if (paint.getMaskFilter()) { | 
| + // Transform the rrect into device space. | 
| + SkRRect devRRect; | 
| + if (rrect.transform(*fMatrix, &devRRect)) { | 
| + SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, paint); | 
| + if (paint.getMaskFilter()->filterRRect(devRRect, *fMatrix, *fRC, | 
| + fBounder, blitter.get(), | 
| + SkPaint::kFill_Style)) { | 
| + return; // filterRRect() called the blitter, so we're done | 
| + } | 
| + } | 
| + } | 
| + | 
| +DRAW_PATH: | 
| + // Now fall back to the default case of using a path. | 
| + SkPath path; | 
| + path.addRRect(rrect); | 
| + this->drawPath(path, paint, NULL, true); | 
| +} | 
| + | 
| void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, | 
| const SkMatrix* prePathMatrix, bool pathIsMutable) const { | 
| SkDEBUGCODE(this->validate();) |