OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "SkAnnotation.h" | 10 #include "SkAnnotation.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 canvas->restore(); | 43 canvas->restore(); |
44 | 44 |
45 canvas->save(); | 45 canvas->save(); |
46 canvas->translate(SkIntToScalar(200), SkIntToScalar(200)); | 46 canvas->translate(SkIntToScalar(200), SkIntToScalar(200)); |
47 SkPoint point = SkPoint::Make(SkIntToScalar(100), SkIntToScalar(50)); | 47 SkPoint point = SkPoint::Make(SkIntToScalar(100), SkIntToScalar(50)); |
48 drawLabeledRect(canvas, "Target A", point.x(), point.y()); | 48 drawLabeledRect(canvas, "Target A", point.x(), point.y()); |
49 SkAnnotateNamedDestination(canvas, point, name.get()); | 49 SkAnnotateNamedDestination(canvas, point, name.get()); |
50 canvas->restore(); | 50 canvas->restore(); |
51 } | 51 } |
52 | 52 |
53 virtual uint32_t onGetFlags() const { | |
54 return kSkipPipe_Flag; | |
55 } | |
56 | |
57 private: | 53 private: |
58 /** Draw an arbitrary rectangle at a given location and label it with some | 54 /** Draw an arbitrary rectangle at a given location and label it with some |
59 * text. */ | 55 * text. */ |
60 void drawLabeledRect(SkCanvas* canvas, const char* text, SkScalar x, SkScala
r y) { | 56 void drawLabeledRect(SkCanvas* canvas, const char* text, SkScalar x, SkScala
r y) { |
61 SkPaint paint; | 57 SkPaint paint; |
62 paint.setColor(SK_ColorBLUE); | 58 paint.setColor(SK_ColorBLUE); |
63 SkRect rect = SkRect::MakeXYWH(x, y, | 59 SkRect rect = SkRect::MakeXYWH(x, y, |
64 SkIntToScalar(50), SkIntToScalar(20)); | 60 SkIntToScalar(50), SkIntToScalar(20)); |
65 canvas->drawRect(rect, paint); | 61 canvas->drawRect(rect, paint); |
66 | 62 |
67 paint.setAntiAlias(true); | 63 paint.setAntiAlias(true); |
68 paint.setTextSize(SkIntToScalar(25)); | 64 paint.setTextSize(SkIntToScalar(25)); |
69 paint.setColor(SK_ColorBLACK); | 65 paint.setColor(SK_ColorBLACK); |
70 canvas->drawText(text, strlen(text), x, y, paint); | 66 canvas->drawText(text, strlen(text), x, y, paint); |
71 } | 67 } |
72 | 68 |
73 typedef GM INHERITED; | 69 typedef GM INHERITED; |
74 }; | 70 }; |
75 | 71 |
76 ////////////////////////////////////////////////////////////////////////////// | 72 ////////////////////////////////////////////////////////////////////////////// |
77 | 73 |
78 static GM* MyFactory(void*) { return SkNEW(InternalLinksGM); } | 74 static GM* MyFactory(void*) { return SkNEW(InternalLinksGM); } |
79 static GMRegistry reg(MyFactory); | 75 static GMRegistry reg(MyFactory); |
80 | 76 |
81 } | 77 } |
OLD | NEW |