blob: 17f69c574516f42d44cc4f749f50f34c0e27d302 [file] [log] [blame]
reed@google.com5a649022013-06-05 18:00:30 +00001/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm.h"
9#include "SkCanvas.h"
10#include "SkPath.h"
11
12/**
13 * Skia may draw from outlines when the size is very large, so we exercise that
14 * here.
15*/
16
17class BigTextGM : public skiagm::GM {
18public:
19 BigTextGM() {}
20
21protected:
commit-bot@chromium.orga90c6802014-04-30 13:20:45 +000022
mtklein36352bf2015-03-25 18:17:31 -070023 SkString onShortName() override {
reed@google.com5a649022013-06-05 18:00:30 +000024 return SkString("bigtext");
25 }
26
mtklein36352bf2015-03-25 18:17:31 -070027 SkISize onISize() override {
reed@google.com5a649022013-06-05 18:00:30 +000028 return SkISize::Make(640, 480);
29 }
30
mtklein36352bf2015-03-25 18:17:31 -070031 void onDraw(SkCanvas* canvas) override {
reed@google.com5a649022013-06-05 18:00:30 +000032 SkPaint paint;
33 paint.setAntiAlias(true);
caryclark1818acb2015-07-24 12:09:25 -070034 sk_tool_utils::set_portable_typeface(&paint);
reed@google.com5a649022013-06-05 18:00:30 +000035 paint.setTextSize(1500);
36
37 SkRect r;
38 (void)paint.measureText("/", 1, &r);
39 SkPoint pos = {
40 this->width()/2 - r.centerX(),
41 this->height()/2 - r.centerY()
42 };
43
44 paint.setColor(SK_ColorRED);
45 canvas->drawText("/", 1, pos.fX, pos.fY, paint);
skia.committer@gmail.comc5fd0932013-06-06 07:01:37 +000046
reed@google.com5a649022013-06-05 18:00:30 +000047 paint.setColor(SK_ColorBLUE);
48 canvas->drawPosText("\\", 1, &pos, paint);
49 }
50
51private:
52 typedef skiagm::GM INHERITED;
53};
54
halcanary385fe4d2015-08-26 13:07:48 -070055DEF_GM(return new BigTextGM;)