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

Side by Side Diff: src/core/SkAnnotation.cpp

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 | « include/core/SkAnnotation.h ('k') | src/core/SkPaint.cpp » ('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 #include "SkAnnotation.h" 8 #include "SkAnnotation.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 SkAnnotation::~SkAnnotation() { 25 SkAnnotation::~SkAnnotation() {
26 fData->unref(); 26 fData->unref();
27 } 27 }
28 28
29 SkData* SkAnnotation::find(const char key[]) const { 29 SkData* SkAnnotation::find(const char key[]) const {
30 return fKey.equals(key) ? fData : NULL; 30 return fKey.equals(key) ? fData : NULL;
31 } 31 }
32 32
33 SkAnnotation::SkAnnotation(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { 33 SkAnnotation::SkAnnotation(SkFlattenableReadBuffer& buffer) {
34 fFlags = buffer.readUInt(); 34 fFlags = buffer.readUInt();
35 buffer.readString(&fKey); 35 buffer.readString(&fKey);
36 fData = buffer.readByteArrayAsData(); 36 fData = buffer.readByteArrayAsData();
37 } 37 }
38 38
39 void SkAnnotation::flatten(SkFlattenableWriteBuffer& buffer) const { 39 void SkAnnotation::writeToBuffer(SkFlattenableWriteBuffer& buffer) const {
40 buffer.writeUInt(fFlags); 40 buffer.writeUInt(fFlags);
41 buffer.writeString(fKey.c_str()); 41 buffer.writeString(fKey.c_str());
42 buffer.writeDataAsByteArray(fData); 42 buffer.writeDataAsByteArray(fData);
43 } 43 }
44 44
45 const char* SkAnnotationKeys::URL_Key() { 45 const char* SkAnnotationKeys::URL_Key() {
46 return "SkAnnotationKey_URL"; 46 return "SkAnnotationKey_URL";
47 }; 47 };
48 48
49 const char* SkAnnotationKeys::Define_Named_Dest_Key() { 49 const char* SkAnnotationKeys::Define_Named_Dest_Key() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 void SkAnnotateLinkToDestination(SkCanvas* canvas, const SkRect& rect, SkData* n ame) { 87 void SkAnnotateLinkToDestination(SkCanvas* canvas, const SkRect& rect, SkData* n ame) {
88 if (NULL == name) { 88 if (NULL == name) {
89 return; 89 return;
90 } 90 }
91 SkPaint paint; 91 SkPaint paint;
92 annotate_paint(paint, SkAnnotationKeys::Link_Named_Dest_Key(), name); 92 annotate_paint(paint, SkAnnotationKeys::Link_Named_Dest_Key(), name);
93 canvas->drawRect(rect, paint); 93 canvas->drawRect(rect, paint);
94 } 94 }
OLDNEW
« no previous file with comments | « include/core/SkAnnotation.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698