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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 }; | 28 }; |
29 | 29 |
30 static const Setting gSettings[] = { | 30 static const Setting gSettings[] = { |
31 { false, false }, | 31 { false, false }, |
32 { false, true }, | 32 { false, true }, |
33 { true, false }, | 33 { true, false }, |
34 { true, true }, | 34 { true, true }, |
35 }; | 35 }; |
36 | 36 |
37 static void doMeasure(SkCanvas* canvas, const SkPaint& paint, const char text[])
{ | 37 static void doMeasure(SkCanvas* canvas, const SkPaint& paint, const char text[])
{ |
38 SkScalar dy = paint.getFontMetrics(NULL); | 38 SkScalar dy = paint.getFontMetrics(nullptr); |
39 | 39 |
40 size_t len = strlen(text); | 40 size_t len = strlen(text); |
41 SkAutoTMalloc<SkScalar> autoWidths(len); | 41 SkAutoTMalloc<SkScalar> autoWidths(len); |
42 SkScalar* widths = autoWidths.get(); | 42 SkScalar* widths = autoWidths.get(); |
43 SkAutoTMalloc<SkRect> autoRects(len); | 43 SkAutoTMalloc<SkRect> autoRects(len); |
44 SkRect* rects = autoRects.get(); | 44 SkRect* rects = autoRects.get(); |
45 SkRect bounds; | 45 SkRect bounds; |
46 | 46 |
47 SkPaint p(paint); | 47 SkPaint p(paint); |
48 for (size_t i = 0; i < SK_ARRAY_COUNT(gSettings); i++) { | 48 for (size_t i = 0; i < SK_ARRAY_COUNT(gSettings); i++) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 private: | 106 private: |
107 typedef SampleView INHERITED; | 107 typedef SampleView INHERITED; |
108 }; | 108 }; |
109 | 109 |
110 ////////////////////////////////////////////////////////////////////////////// | 110 ////////////////////////////////////////////////////////////////////////////// |
111 | 111 |
112 static SkView* MyFactory() { return new MeasureView; } | 112 static SkView* MyFactory() { return new MeasureView; } |
113 static SkViewRegister reg(MyFactory); | 113 static SkViewRegister reg(MyFactory); |
OLD | NEW |