blob: 17f69c574516f42d44cc4f749f50f34c0e27d302 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* 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:
SkString onShortName() override {
return SkString("bigtext");
}
SkISize onISize() override {
return SkISize::Make(640, 480);
}
void onDraw(SkCanvas* canvas) override {
SkPaint paint;
paint.setAntiAlias(true);
sk_tool_utils::set_portable_typeface(&paint);
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 new BigTextGM;)
|