aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/strokefill.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-17 18:26:38 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-17 18:26:38 +0000
commit188bfcf7666f4d264329063fd9bf5c44e7734fd8 (patch)
tree307c8a1d8350b0ae4d3359d13f5e38a060112a5a /gm/strokefill.cpp
parent0e06f92bf6853142c7f6850f4e6d7c13c813c39d (diff)
if the y-max has neighbors (prev and next) with the same Y values, then the
cross will be 0, but we can still know the direction by looking at the change in X Fixes the hypen in #7 of this bug http://code.google.com/p/chromium/issues/detail?id=109370 git-svn-id: http://skia.googlecode.com/svn/trunk@3049 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/strokefill.cpp')
-rw-r--r--gm/strokefill.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp
index a37af806f4..75fa0087fb 100644
--- a/gm/strokefill.cpp
+++ b/gm/strokefill.cpp
@@ -27,24 +27,35 @@ protected:
return make_isize(640, 480);
}
+ static void show_bold(SkCanvas* canvas, const char text[], SkScalar x,
+ SkScalar y, const SkPaint& paint) {
+ size_t len = strlen(text);
+ SkPaint p(paint);
+ canvas->drawText(text, len, x, y, p);
+ p.setFakeBoldText(true);
+ canvas->drawText(text, len, x, y + SkIntToScalar(120), p);
+ }
+
virtual void onDraw(SkCanvas* canvas) {
+ SkScalar x = SkIntToScalar(100);
+ SkScalar y = SkIntToScalar(88);
+
SkPaint paint;
- const char text[] = "Hello"; // "Hello";
- const size_t len = sizeof(text) - 1;
paint.setAntiAlias(true);
paint.setTextSize(SkIntToScalar(100));
-// SkTypeface* hira = SkTypeface::CreateFromName("Hiragino Maru Gothic Pro", SkTypeface::kNormal);
- SkTypeface* hira = SkTypeface::CreateFromName("Papyrus", SkTypeface::kNormal);
- paint.setTypeface(hira);
- SkScalar x = SkIntToScalar(180);
- SkScalar y = SkIntToScalar(88);
-
- canvas->drawText(text, len, x, y, paint);
- paint.setFakeBoldText(true);
- canvas->drawText(text, len, x, y + SkIntToScalar(100), paint);
- paint.setStyle(SkPaint::kStrokeAndFill_Style);
paint.setStrokeWidth(SkIntToScalar(5));
+ SkTypeface* face = SkTypeface::CreateFromName("Papyrus", SkTypeface::kNormal);
+ SkSafeUnref(paint.setTypeface(face));
+ show_bold(canvas, "Hello", x, y, paint);
+
+ face = SkTypeface::CreateFromName("Hiragino Maru Gothic Pro", SkTypeface::kNormal);
+ SkSafeUnref(paint.setTypeface(face));
+ const char hyphen[] = { 0xE3, 0x83, 0xBC, 0 };
+ show_bold(canvas, hyphen, x + SkIntToScalar(300), y, paint);
+
+ paint.setStyle(SkPaint::kStrokeAndFill_Style);
+
SkPath path;
path.setFillType(SkPath::kWinding_FillType);
path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW_Direction);