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

Unified Diff: gm/roundrects.cpp

Issue 2272703009: Add fat stroke test case to roundrects GM. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/roundrects.cpp
diff --git a/gm/roundrects.cpp b/gm/roundrects.cpp
index 9554705b49d11215bae41cc807eb276cf9f22da5..fbb005ffc0b4d9d508b58bd6ec55dbeca47f36cd 100644
--- a/gm/roundrects.cpp
+++ b/gm/roundrects.cpp
@@ -47,92 +47,92 @@ protected:
void makePaints() {
{
- // no AA
- SkPaint p;
- fPaints.push_back(p);
+ // no AA
+ SkPaint p;
+ fPaints.push_back(p);
}
{
- // AA
- SkPaint p;
- p.setAntiAlias(true);
- fPaints.push_back(p);
+ // AA
+ SkPaint p;
+ p.setAntiAlias(true);
+ fPaints.push_back(p);
}
{
- // AA with stroke style
- SkPaint p;
- p.setAntiAlias(true);
- p.setStyle(SkPaint::kStroke_Style);
- p.setStrokeWidth(SkIntToScalar(5));
- fPaints.push_back(p);
+ // AA with stroke style
+ SkPaint p;
+ p.setAntiAlias(true);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setStrokeWidth(SkIntToScalar(5));
+ fPaints.push_back(p);
}
{
- // AA with stroke style, width = 0
- SkPaint p;
- p.setAntiAlias(true);
- p.setStyle(SkPaint::kStroke_Style);
- fPaints.push_back(p);
+ // AA with stroke style, width = 0
+ SkPaint p;
+ p.setAntiAlias(true);
+ p.setStyle(SkPaint::kStroke_Style);
+ fPaints.push_back(p);
}
{
- // AA with stroke and fill style
- SkPaint p;
- p.setAntiAlias(true);
- p.setStyle(SkPaint::kStrokeAndFill_Style);
- p.setStrokeWidth(SkIntToScalar(3));
- fPaints.push_back(p);
+ // AA with stroke and fill style
+ SkPaint p;
+ p.setAntiAlias(true);
+ p.setStyle(SkPaint::kStrokeAndFill_Style);
+ p.setStrokeWidth(SkIntToScalar(3));
+ fPaints.push_back(p);
}
}
void makeMatrices() {
{
- SkMatrix m;
- m.setIdentity();
- fMatrices.push_back(m);
+ SkMatrix m;
+ m.setIdentity();
+ fMatrices.push_back(m);
}
{
- SkMatrix m;
- m.setScale(SkIntToScalar(3), SkIntToScalar(2));
- fMatrices.push_back(m);
+ SkMatrix m;
+ m.setScale(SkIntToScalar(3), SkIntToScalar(2));
+ fMatrices.push_back(m);
}
{
- SkMatrix m;
- m.setScale(SkIntToScalar(2), SkIntToScalar(2));
- fMatrices.push_back(m);
+ SkMatrix m;
+ m.setScale(SkIntToScalar(2), SkIntToScalar(2));
+ fMatrices.push_back(m);
}
{
- SkMatrix m;
- m.setScale(SkIntToScalar(1), SkIntToScalar(2));
- fMatrices.push_back(m);
+ SkMatrix m;
+ m.setScale(SkIntToScalar(1), SkIntToScalar(2));
+ fMatrices.push_back(m);
}
{
- SkMatrix m;
- m.setScale(SkIntToScalar(4), SkIntToScalar(1));
- fMatrices.push_back(m);
+ SkMatrix m;
+ m.setScale(SkIntToScalar(4), SkIntToScalar(1));
+ fMatrices.push_back(m);
}
{
- SkMatrix m;
- m.setRotate(SkIntToScalar(90));
- fMatrices.push_back(m);
+ SkMatrix m;
+ m.setRotate(SkIntToScalar(90));
+ fMatrices.push_back(m);
}
{
- SkMatrix m;
- m.setSkew(SkIntToScalar(2), SkIntToScalar(3));
- fMatrices.push_back(m);
+ SkMatrix m;
+ m.setSkew(SkIntToScalar(2), SkIntToScalar(3));
+ fMatrices.push_back(m);
}
{
- SkMatrix m;
- m.setRotate(SkIntToScalar(60));
- fMatrices.push_back(m);
+ SkMatrix m;
+ m.setRotate(SkIntToScalar(60));
+ fMatrices.push_back(m);
}
}
@@ -337,6 +337,30 @@ protected:
canvas->restore();
}
+
+ // rrect with stroke > radius/2
+ {
+ SkRect smallRect = { -30, -20, 30, 20 };
+ SkRRect circleRect;
+ circleRect.setRectXY(smallRect, 5, 5);
+
+ canvas->save();
+ // position the roundrect, and make it at off-integer coords.
+ canvas->translate(kXStart + SK_Scalar1 * kXStep * 5 + SK_Scalar1 / 4,
+ kYStart - SK_Scalar1 * kYStep + 73 * SK_Scalar1 / 4 +
+ SK_ScalarHalf * kYStep);
+
+ SkColor color = gen_color(&rand);
+
+ SkPaint p;
+ p.setAntiAlias(true);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setStrokeWidth(25);
+ p.setColor(color);
+
+ canvas->drawRRect(circleRect, p);
+ canvas->restore();
+ }
}
private:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698