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

Unified Diff: gm/bigtext.cpp

Issue 16378003: call through to the device from SkDraw (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 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 | gyp/gmslides.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/bigtext.cpp
diff --git a/gm/bigtext.cpp b/gm/bigtext.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e8bddf80c4153d59d07bcabe54f7956feff2f885
--- /dev/null
+++ b/gm/bigtext.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "gm.h"
+#include "SkCanvas.h"
+#include "SkPath.h"
+
+/**
+ * Skia may draw from outlines when the size is very large, so we exercise that
+ * here.
+*/
+
+class BigTextGM : public skiagm::GM {
+public:
+ BigTextGM() {}
+
+protected:
+ virtual SkString onShortName() SK_OVERRIDE {
+ return SkString("bigtext");
+ }
+
+ virtual SkISize onISize() SK_OVERRIDE {
+ return SkISize::Make(640, 480);
+ }
+
+ virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(1500);
+
+ SkRect r;
+ (void)paint.measureText("/", 1, &r);
+ SkPoint pos = {
+ this->width()/2 - r.centerX(),
+ this->height()/2 - r.centerY()
+ };
+
+ paint.setColor(SK_ColorRED);
+ canvas->drawText("/", 1, pos.fX, pos.fY, paint);
+
+ paint.setColor(SK_ColorBLUE);
+ canvas->drawPosText("\\", 1, &pos, paint);
+ }
+
+private:
+ typedef skiagm::GM INHERITED;
+};
+
+DEF_GM( return SkNEW(BigTextGM); )
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698