| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkTypeface.h" | 11 #include "SkTypeface.h" |
| 12 #include "SkPath.h" | 12 #include "SkPath.h" |
| 13 #include "SkRegion.h" | 13 #include "SkRegion.h" |
| 14 #include "SkShader.h" | 14 #include "SkShader.h" |
| 15 #include "SkUtils.h" | 15 #include "SkUtils.h" |
| 16 #include "Sk1DPathEffect.h" | 16 #include "Sk1DPathEffect.h" |
| 17 #include "SkCornerPathEffect.h" | 17 #include "SkCornerPathEffect.h" |
| 18 #include "SkPathMeasure.h" | 18 #include "SkPathMeasure.h" |
| 19 #include "SkRandom.h" | 19 #include "SkRandom.h" |
| 20 #include "SkColorPriv.h" | 20 #include "SkColorPriv.h" |
| 21 #include "SkColorFilter.h" | 21 #include "SkColorFilter.h" |
| 22 #include "SkDither.h" | 22 #include "SkDither.h" |
| 23 | 23 |
| 24 static const struct { | 24 static const struct { |
| 25 const char* fName; | 25 const char* fName; |
| 26 SkTypeface::Style fStyle; | 26 SkTypeface::Style fStyle; |
| 27 } gFaces[] = { | 27 } gFaces[] = { |
| 28 { NULL, SkTypeface::kNormal }, | 28 { nullptr, SkTypeface::kNormal }, |
| 29 { NULL, SkTypeface::kBold }, | 29 { nullptr, SkTypeface::kBold }, |
| 30 { "serif", SkTypeface::kNormal }, | 30 { "serif", SkTypeface::kNormal }, |
| 31 { "serif", SkTypeface::kBold }, | 31 { "serif", SkTypeface::kBold }, |
| 32 { "serif", SkTypeface::kItalic }, | 32 { "serif", SkTypeface::kItalic }, |
| 33 { "serif", SkTypeface::kBoldItalic }, | 33 { "serif", SkTypeface::kBoldItalic }, |
| 34 { "monospace", SkTypeface::kNormal } | 34 { "monospace", SkTypeface::kNormal } |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 static const int gFaceCount = SK_ARRAY_COUNT(gFaces); | 37 static const int gFaceCount = SK_ARRAY_COUNT(gFaces); |
| 38 | 38 |
| 39 class FontScalerTestView : public SampleView { | 39 class FontScalerTestView : public SampleView { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 p.setAntiAlias(true); | 114 p.setAntiAlias(true); |
| 115 SkRect r; | 115 SkRect r; |
| 116 r.set(x-3, 15, x-1, 280); | 116 r.set(x-3, 15, x-1, 280); |
| 117 canvas->drawRect(r, p); | 117 canvas->drawRect(r, p); |
| 118 } | 118 } |
| 119 | 119 |
| 120 int index = 0; | 120 int index = 0; |
| 121 for (int ps = 6; ps <= 22; ps++) { | 121 for (int ps = 6; ps <= 22; ps++) { |
| 122 paint.setTextSize(SkIntToScalar(ps)); | 122 paint.setTextSize(SkIntToScalar(ps)); |
| 123 canvas->drawText(text, textLen, x, y, paint); | 123 canvas->drawText(text, textLen, x, y, paint); |
| 124 y += paint.getFontMetrics(NULL); | 124 y += paint.getFontMetrics(nullptr); |
| 125 index += 1; | 125 index += 1; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 canvas->translate(0, 400); | 128 canvas->translate(0, 400); |
| 129 paint.setSubpixelText(true); | 129 paint.setSubpixelText(true); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 typedef SkView INHERITED; | 134 typedef SkView INHERITED; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 ////////////////////////////////////////////////////////////////////////////// | 137 ////////////////////////////////////////////////////////////////////////////// |
| 138 | 138 |
| 139 static SkView* MyFactory() { return new FontScalerTestView; } | 139 static SkView* MyFactory() { return new FontScalerTestView; } |
| 140 static SkViewRegister reg(MyFactory); | 140 static SkViewRegister reg(MyFactory); |
| OLD | NEW |