@@ -2440,16 +2440,33 @@ status_t OpenGLRenderer::drawArc(float left, float top, float right, float botto
24402440 return drawShape (left, top, texture, paint);
24412441}
24422442
2443+ // See SkPaintDefaults.h
2444+ #define SkPaintDefaults_MiterLimit SkIntToScalar (4 )
2445+
24432446status_t OpenGLRenderer::drawRect(float left, float top, float right, float bottom, SkPaint* p) {
24442447 if (mSnapshot ->isIgnored () || quickRejectPreStroke (left, top, right, bottom, p)) {
24452448 return DrawGlInfo::kStatusDone ;
24462449 }
24472450
2448- // only fill style is supported by drawConvexPath, since others have to handle joins
24492451 if (p->getStyle () != SkPaint::kFill_Style ) {
2450- mCaches .activeTexture (0 );
2451- const PathTexture* texture = mCaches .rectShapeCache .getRect (right - left, bottom - top, p);
2452- return drawShape (left, top, texture, p);
2452+ // only fill style is supported by drawConvexPath, since others have to handle joins
2453+ if (p->getPathEffect () != 0 || p->getStrokeJoin () != SkPaint::kMiter_Join ||
2454+ p->getStrokeMiter () != SkPaintDefaults_MiterLimit) {
2455+ mCaches .activeTexture (0 );
2456+ const PathTexture* texture =
2457+ mCaches .rectShapeCache .getRect (right - left, bottom - top, p);
2458+ return drawShape (left, top, texture, p);
2459+ }
2460+
2461+ SkPath path;
2462+ SkRect rect = SkRect::MakeLTRB (left, top, right, bottom);
2463+ if (p->getStyle () == SkPaint::kStrokeAndFill_Style ) {
2464+ rect.outset (p->getStrokeWidth () / 2 , p->getStrokeWidth () / 2 );
2465+ }
2466+ path.addRect (rect);
2467+ drawConvexPath (path, p);
2468+
2469+ return DrawGlInfo::kStatusDrew ;
24532470 }
24542471
24552472 if (p->isAntiAlias () && !mSnapshot ->transform ->isSimple ()) {
0 commit comments