| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkAnnotation_DEFINED | 8 #ifndef SkAnnotation_DEFINED |
| 9 #define SkAnnotation_DEFINED | 9 #define SkAnnotation_DEFINED |
| 10 | 10 |
| 11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
| 12 #include "SkString.h" | 12 #include "SkString.h" |
| 13 #include "SkTypes.h" | 13 #include "SkTypes.h" |
| 14 | 14 |
| 15 class SkData; | 15 class SkData; |
| 16 class SkReadBuffer; | 16 class SkReadBuffer; |
| 17 class SkWriteBuffer; | 17 class SkWriteBuffer; |
| 18 struct SkPoint; | 18 struct SkPoint; |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Experimental class for annotating draws. Do not use directly yet. | 21 * Experimental class for annotating draws. Do not use directly yet. |
| 22 * Use helper functions at the bottom of this file for now. | 22 * Use helper functions at the bottom of this file for now. |
| 23 */ | 23 */ |
| 24 class SkAnnotation : public SkRefCnt { | 24 class SkAnnotation : public SkRefCnt { |
| 25 public: | 25 public: |
| 26 virtual ~SkAnnotation(); | 26 virtual ~SkAnnotation(); |
| 27 | 27 |
| 28 static SkAnnotation* Create(const char key[], SkData* value) { | 28 static SkAnnotation* Create(const char key[], SkData* value) { |
| 29 return SkNEW_ARGS(SkAnnotation, (key, value)); | 29 return new SkAnnotation(key, value); |
| 30 } | 30 } |
| 31 | 31 |
| 32 static SkAnnotation* Create(SkReadBuffer& buffer) { | 32 static SkAnnotation* Create(SkReadBuffer& buffer) { return new SkAnnotation(
buffer); } |
| 33 return SkNEW_ARGS(SkAnnotation, (buffer)); | |
| 34 } | |
| 35 | 33 |
| 36 /** | 34 /** |
| 37 * Return the data for the specified key, or NULL. | 35 * Return the data for the specified key, or NULL. |
| 38 */ | 36 */ |
| 39 SkData* find(const char key[]) const; | 37 SkData* find(const char key[]) const; |
| 40 | 38 |
| 41 void writeToBuffer(SkWriteBuffer&) const; | 39 void writeToBuffer(SkWriteBuffer&) const; |
| 42 | 40 |
| 43 private: | 41 private: |
| 44 SkAnnotation(const char key[], SkData* value); | 42 SkAnnotation(const char key[], SkData* value); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 * | 111 * |
| 114 * If the backend of this canvas does not support annotations, this call is | 112 * If the backend of this canvas does not support annotations, this call is |
| 115 * safely ignored. | 113 * safely ignored. |
| 116 * | 114 * |
| 117 * The caller is responsible for managing its ownership of the SkData. | 115 * The caller is responsible for managing its ownership of the SkData. |
| 118 */ | 116 */ |
| 119 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); | 117 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); |
| 120 | 118 |
| 121 | 119 |
| 122 #endif | 120 #endif |
| OLD | NEW |