skia2/gm/bigtext.cpp
skia.committer@gmail.com c5fd093ae2 Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@9452 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-06-06 07:01:37 +00:00

54 lines
1.1 KiB
C++

/*
* 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); )