Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: include/core/SkAnnotation.h

Issue 27208002: remove SkDataSet, and just store a key/value in SkAnnotation (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gyp/public_headers.gypi ('k') | include/core/SkDataSet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkFlattenable.h" 11 #include "SkFlattenable.h"
12 #include "SkString.h"
12 13
13 class SkData; 14 class SkData;
14 class SkDataSet;
15 class SkStream; 15 class SkStream;
16 class SkWStream; 16 class SkWStream;
17 struct SkPoint; 17 struct SkPoint;
18 18
19 /** 19 /**
20 * Experimental class for annotating draws. Do not use directly yet. 20 * Experimental class for annotating draws. Do not use directly yet.
21 * Use helper functions at the bottom of this file for now. 21 * Use helper functions at the bottom of this file for now.
22 */ 22 */
23 class SkAnnotation : public SkFlattenable { 23 class SkAnnotation : public SkFlattenable {
24 public: 24 public:
25 enum Flags { 25 enum Flags {
26 // If set, the associated drawing primitive should not be drawn 26 // If set, the associated drawing primitive should not be drawn
27 kNoDraw_Flag = 1 << 0, 27 kNoDraw_Flag = 1 << 0,
28 }; 28 };
29 29
30 SkAnnotation(SkDataSet*, uint32_t flags); 30 SkAnnotation(const char key[], SkData* value, uint32_t flags);
31 virtual ~SkAnnotation(); 31 virtual ~SkAnnotation();
32 32
33 uint32_t getFlags() const { return fFlags; } 33 uint32_t getFlags() const { return fFlags; }
34 SkDataSet* getDataSet() const { return fDataSet; }
35 34
36 bool isNoDraw() const { return SkToBool(fFlags & kNoDraw_Flag); } 35 bool isNoDraw() const { return SkToBool(fFlags & kNoDraw_Flag); }
37 36
38 /** 37 /**
39 * Helper for search the annotation's dataset. 38 * Return the data for the specified key, or NULL.
40 */ 39 */
41 SkData* find(const char name[]) const; 40 SkData* find(const char key[]) const;
42 41
43 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAnnotation) 42 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAnnotation)
44 43
45 protected: 44 protected:
46 SkAnnotation(SkFlattenableReadBuffer&); 45 SkAnnotation(SkFlattenableReadBuffer&);
47 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 46 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
48 47
49 private: 48 private:
50 SkDataSet* fDataSet; 49 SkString fKey;
50 SkData* fData;
51 uint32_t fFlags; 51 uint32_t fFlags;
52 52
53 void writeToStream(SkWStream*) const; 53 void writeToStream(SkWStream*) const;
54 void readFromStream(SkStream*); 54 void readFromStream(SkStream*);
55 55
56 typedef SkFlattenable INHERITED; 56 typedef SkFlattenable INHERITED;
57 }; 57 };
58 58
59 /** 59 /**
60 * Experimental collection of predefined Keys into the Annotation dictionary 60 * Experimental collection of predefined Keys into the Annotation dictionary
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * 119 *
120 * If the backend of this canvas does not support annotations, this call is 120 * If the backend of this canvas does not support annotations, this call is
121 * safely ignored. 121 * safely ignored.
122 * 122 *
123 * The caller is responsible for managing its ownership of the SkData. 123 * The caller is responsible for managing its ownership of the SkData.
124 */ 124 */
125 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); 125 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*);
126 126
127 127
128 #endif 128 #endif
OLDNEW
« no previous file with comments | « gyp/public_headers.gypi ('k') | include/core/SkDataSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698