2013-06-05 18:00:30 +00:00
|
|
|
/*
|
|
|
|
* 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"
|
2017-03-22 17:47:51 +00:00
|
|
|
#include "sk_tool_utils.h"
|
2013-06-05 18:00:30 +00:00
|
|
|
#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:
|
2014-04-30 13:20:45 +00:00
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
SkString onShortName() override {
|
2013-06-05 18:00:30 +00:00
|
|
|
return SkString("bigtext");
|
|
|
|
}
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
SkISize onISize() override {
|
2013-06-05 18:00:30 +00:00
|
|
|
return SkISize::Make(640, 480);
|
|
|
|
}
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
void onDraw(SkCanvas* canvas) override {
|
2013-06-05 18:00:30 +00:00
|
|
|
SkPaint paint;
|
|
|
|
paint.setAntiAlias(true);
|
2015-07-24 19:09:25 +00:00
|
|
|
sk_tool_utils::set_portable_typeface(&paint);
|
2013-06-05 18:00:30 +00:00
|
|
|
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);
|
2017-04-28 19:35:12 +00:00
|
|
|
canvas->drawString("/", pos.fX, pos.fY, paint);
|
2013-06-06 07:01:37 +00:00
|
|
|
|
2013-06-05 18:00:30 +00:00
|
|
|
paint.setColor(SK_ColorBLUE);
|
|
|
|
canvas->drawPosText("\\", 1, &pos, paint);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef skiagm::GM INHERITED;
|
|
|
|
};
|
|
|
|
|
2015-08-26 20:07:48 +00:00
|
|
|
DEF_GM(return new BigTextGM;)
|