blob: 9c2682c15b80a0d0052e8ea70c1318eab4e2bd31 [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 virtual uint32_t onGetFlags() const SK_OVERRIDE {
23 return kSkipTiled_Flag;
24 }
25
reed@google.com5a649022013-06-05 18:00:30 +000026 virtual SkString onShortName() SK_OVERRIDE {
27 return SkString("bigtext");
28 }
29
30 virtual SkISize onISize() SK_OVERRIDE {
31 return SkISize::Make(640, 480);
32 }
33
34 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
35 SkPaint paint;
36 paint.setAntiAlias(true);
37 paint.setTextSize(1500);
38
39 SkRect r;
40 (void)paint.measureText("/", 1, &r);
41 SkPoint pos = {
42 this->width()/2 - r.centerX(),
43 this->height()/2 - r.centerY()
44 };
45
46 paint.setColor(SK_ColorRED);
47 canvas->drawText("/", 1, pos.fX, pos.fY, paint);
skia.committer@gmail.comc5fd0932013-06-06 07:01:37 +000048
reed@google.com5a649022013-06-05 18:00:30 +000049 paint.setColor(SK_ColorBLUE);
50 canvas->drawPosText("\\", 1, &pos, paint);
51 }
52
53private:
54 typedef skiagm::GM INHERITED;
55};
56
57DEF_GM( return SkNEW(BigTextGM); )