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

Unified Diff: gm/xfermodes3.cpp

Issue 22866002: Make xfermodes3 GM also test stroked rects (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: int->size_t Created 7 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/xfermodes3.cpp
diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp
index c14c7856a995fbf2c0844f4c9569485bdbb87f96..f1eff1f3697d6fe0beb18a3750209454cf24a43d 100644
--- a/gm/xfermodes3.cpp
+++ b/gm/xfermodes3.cpp
@@ -32,7 +32,7 @@ protected:
}
virtual SkISize onISize() SK_OVERRIDE {
- return make_isize(630, 620);
+ return make_isize(630, 1215);
}
virtual void onDrawBackground(SkCanvas* canvas) SK_OVERRIDE {
@@ -62,40 +62,50 @@ protected:
int test = 0;
int x = 0, y = 0;
- for (size_t m = 0; m <= SkXfermode::kLastMode; ++m) {
- SkXfermode::Mode mode = static_cast<SkXfermode::Mode>(m);
- canvas->drawText(SkXfermode::ModeName(mode),
- strlen(SkXfermode::ModeName(mode)),
- SkIntToScalar(x),
- SkIntToScalar(y + kSize + 3) + labelP.getTextSize(),
- labelP);
- for (size_t c = 0; c < SK_ARRAY_COUNT(kSolidColors); ++c) {
- SkPaint modePaint;
- modePaint.setXfermodeMode(mode);
- modePaint.setColor(kSolidColors[c]);
-
- this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempCanvas.get());
-
- ++test;
- x += kSize + 10;
- if (!(test % kTestsPerRow)) {
- x = 0;
- y += kSize + 30;
+ static const struct { SkPaint::Style fStyle; SkScalar fWidth; } kStrokes[] = {
+ {SkPaint::kFill_Style, 0},
+ {SkPaint::kStroke_Style, SkIntToScalar(kSize) / 2},
+ };
+ for (size_t s = 0; s < SK_ARRAY_COUNT(kStrokes); ++s) {
+ for (size_t m = 0; m <= SkXfermode::kLastMode; ++m) {
+ SkXfermode::Mode mode = static_cast<SkXfermode::Mode>(m);
+ canvas->drawText(SkXfermode::ModeName(mode),
+ strlen(SkXfermode::ModeName(mode)),
+ SkIntToScalar(x),
+ SkIntToScalar(y + kSize + 3) + labelP.getTextSize(),
+ labelP);
+ for (size_t c = 0; c < SK_ARRAY_COUNT(kSolidColors); ++c) {
+ SkPaint modePaint;
+ modePaint.setXfermodeMode(mode);
+ modePaint.setColor(kSolidColors[c]);
+ modePaint.setStyle(kStrokes[s].fStyle);
+ modePaint.setStrokeWidth(kStrokes[s].fWidth);
+
+ this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempCanvas.get());
+
+ ++test;
+ x += kSize + 10;
+ if (!(test % kTestsPerRow)) {
+ x = 0;
+ y += kSize + 30;
+ }
}
- }
- for (size_t a = 0; a < SK_ARRAY_COUNT(kBmpAlphas); ++a) {
- SkPaint modePaint;
- modePaint.setXfermodeMode(mode);
- modePaint.setAlpha(kBmpAlphas[a]);
- modePaint.setShader(fBmpShader);
-
- this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempCanvas.get());
-
- ++test;
- x += kSize + 10;
- if (!(test % kTestsPerRow)) {
- x = 0;
- y += kSize + 30;
+ for (size_t a = 0; a < SK_ARRAY_COUNT(kBmpAlphas); ++a) {
+ SkPaint modePaint;
+ modePaint.setXfermodeMode(mode);
+ modePaint.setAlpha(kBmpAlphas[a]);
+ modePaint.setShader(fBmpShader);
+ modePaint.setStyle(kStrokes[s].fStyle);
+ modePaint.setStrokeWidth(kStrokes[s].fWidth);
+
+ this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempCanvas.get());
+
+ ++test;
+ x += kSize + 10;
+ if (!(test % kTestsPerRow)) {
+ x = 0;
+ y += kSize + 30;
+ }
}
}
}
« 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