Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: gm/scaletext.cpp

Issue 41213003: Hook in rough distance field support for fonts (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Minor fixes for GrDistanceFieldTextContext. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/common_variables.gypi » ('j') | include/gpu/GrDistanceFieldTextContext.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/scaletext.cpp
diff --git a/gm/fontscaler.cpp b/gm/scaletext.cpp
old mode 100644
new mode 100755
similarity index 80%
copy from gm/fontscaler.cpp
copy to gm/scaletext.cpp
index 33f6779d2c295577432e78e988385e5b94ff170a..c80399113571abf605251e097982a972e3b52c2a
--- a/gm/fontscaler.cpp
+++ b/gm/scaletext.cpp
@@ -9,18 +9,18 @@
namespace skiagm {
robertphillips 2013/11/05 15:30:26 // raison d'etre
-class FontScalerGM : public GM {
+class ScaleTextGM : public GM {
public:
- FontScalerGM() {
+ ScaleTextGM() {
this->setBGColor(0xFFFFFFFF);
}
- virtual ~FontScalerGM() {
+ virtual ~ScaleTextGM() {
}
protected:
virtual SkString onShortName() {
- return SkString("fontscaler");
+ return SkString("scaletext");
}
virtual SkISize onISize() {
@@ -43,21 +43,21 @@ protected:
//With freetype the default (normal hinting) can be really ugly.
//Most distros now set slight (vertical hinting only) in any event.
paint.setHinting(SkPaint::kSlight_Hinting);
- SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromName("Times Roman", SkTypeface::kNormal)));
+ SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromName("Times New Roman", SkTypeface::kNormal)));
- const char* text = "Hamburgefons ooo mmm";
+ const char* text = "Thamburgefons ooo mmm";
const size_t textLen = strlen(text);
robertphillips 2013/11/05 15:30:26 Do we need the 'j' loop anymore?
- for (int j = 0; j < 2; ++j) {
+ for (int j = 0; j < 1; ++j) {
robertphillips 2013/11/05 15:30:26 Remove this comment?
// This used to do 6 iterations but it causes the N4 to crash in the MSAA4 config.
- for (int i = 0; i < 5; ++i) {
+ for (int i = 0; i < 2; ++i) {
SkScalar x = SkIntToScalar(10);
SkScalar y = SkIntToScalar(20);
SkAutoCanvasRestore acr(canvas, true);
- canvas->translate(SkIntToScalar(50 + i * 230),
+ canvas->translate(SkIntToScalar(50 + 4*i * 230),
SkIntToScalar(20));
- rotate_about(canvas, SkIntToScalar(i * 5), x, y * 10);
+ rotate_about(canvas, SkIntToScalar(4*i * 5), x, y * 10);
{
SkPaint p;
@@ -69,7 +69,7 @@ protected:
}
robertphillips 2013/11/05 15:30:26 What is index for?
int index = 0;
robertphillips 2013/11/05 15:30:26 ps seems like a bad name Should 6 & 50 be constant
- for (int ps = 6; ps <= 22; ps++) {
+ for (int ps = 6; ps <= 50; ps += 2) {
paint.setTextSize(SkIntToScalar(ps));
canvas->drawText(text, textLen, x, y, paint);
y += paint.getFontMetrics(NULL);
@@ -87,7 +87,7 @@ private:
//////////////////////////////////////////////////////////////////////////////
robertphillips 2013/11/05 15:30:26 DEF_GM?
-static GM* MyFactory(void*) { return new FontScalerGM; }
+static GM* MyFactory(void*) { return new ScaleTextGM; }
static GMRegistry reg(MyFactory);
}
« no previous file with comments | « no previous file | gyp/common_variables.gypi » ('j') | include/gpu/GrDistanceFieldTextContext.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698