| 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 |
| 53 private: | 57 private: |
| 54 /** Draw an arbitrary rectangle at a given location and label it with some | 58 /** Draw an arbitrary rectangle at a given location and label it with some |
| 55 * text. */ | 59 * text. */ |
| 56 void drawLabeledRect(SkCanvas* canvas, const char* text, SkScalar x, SkScala
r y) { | 60 void drawLabeledRect(SkCanvas* canvas, const char* text, SkScalar x, SkScala
r y) { |
| 57 SkPaint paint; | 61 SkPaint paint; |
| 58 paint.setColor(SK_ColorBLUE); | 62 paint.setColor(SK_ColorBLUE); |
| 59 SkRect rect = SkRect::MakeXYWH(x, y, | 63 SkRect rect = SkRect::MakeXYWH(x, y, |
| 60 SkIntToScalar(50), SkIntToScalar(20)); | 64 SkIntToScalar(50), SkIntToScalar(20)); |
| 61 canvas->drawRect(rect, paint); | 65 canvas->drawRect(rect, paint); |
| 62 | 66 |
| 63 paint.setAntiAlias(true); | 67 paint.setAntiAlias(true); |
| 64 paint.setTextSize(SkIntToScalar(25)); | 68 paint.setTextSize(SkIntToScalar(25)); |
| 65 paint.setColor(SK_ColorBLACK); | 69 paint.setColor(SK_ColorBLACK); |
| 66 canvas->drawText(text, strlen(text), x, y, paint); | 70 canvas->drawText(text, strlen(text), x, y, paint); |
| 67 } | 71 } |
| 68 | 72 |
| 69 typedef GM INHERITED; | 73 typedef GM INHERITED; |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 ////////////////////////////////////////////////////////////////////////////// | 76 ////////////////////////////////////////////////////////////////////////////// |
| 73 | 77 |
| 74 static GM* MyFactory(void*) { return SkNEW(InternalLinksGM); } | 78 static GM* MyFactory(void*) { return SkNEW(InternalLinksGM); } |
| 75 static GMRegistry reg(MyFactory); | 79 static GMRegistry reg(MyFactory); |
| 76 | 80 |
| 77 } | 81 } |
| OLD | NEW |