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

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

Issue 26606004: change SkAnnotation to not inherit from SkFlattenable (does not need dynamic factories) (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 | « no previous file | src/core/SkAnnotation.cpp » ('j') | src/pipe/SkGPipeRead.cpp » ('J')
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"
scroggo 2013/10/14 18:47:19 Can this be removed?
reed1 2013/10/14 19:38:41 Done.
12 #include "SkString.h" 12 #include "SkString.h"
13 13
14 class SkData; 14 class SkData;
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 SkRefCnt {
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(const char key[], SkData* value, 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 34
35 bool isNoDraw() const { return SkToBool(fFlags & kNoDraw_Flag); } 35 bool isNoDraw() const { return SkToBool(fFlags & kNoDraw_Flag); }
36 36
37 /** 37 /**
38 * Return the data for the specified key, or NULL. 38 * Return the data for the specified key, or NULL.
39 */ 39 */
40 SkData* find(const char key[]) const; 40 SkData* find(const char key[]) const;
41 41
42 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAnnotation)
43
44 protected:
45 SkAnnotation(SkFlattenableReadBuffer&); 42 SkAnnotation(SkFlattenableReadBuffer&);
46 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 43 void writeToBuffer(SkFlattenableWriteBuffer&) const;
47 44
48 private: 45 private:
49 SkString fKey; 46 SkString fKey;
50 SkData* fData; 47 SkData* fData;
51 uint32_t fFlags; 48 uint32_t fFlags;
52 49
53 void writeToStream(SkWStream*) const; 50 void writeToStream(SkWStream*) const;
54 void readFromStream(SkStream*); 51 void readFromStream(SkStream*);
55 52
56 typedef SkFlattenable INHERITED; 53 typedef SkFlattenable INHERITED;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * 116 *
120 * If the backend of this canvas does not support annotations, this call is 117 * If the backend of this canvas does not support annotations, this call is
121 * safely ignored. 118 * safely ignored.
122 * 119 *
123 * The caller is responsible for managing its ownership of the SkData. 120 * The caller is responsible for managing its ownership of the SkData.
124 */ 121 */
125 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); 122 SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*);
126 123
127 124
128 #endif 125 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkAnnotation.cpp » ('j') | src/pipe/SkGPipeRead.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698