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

Unified Diff: include/core/SkAnnotation.h

Issue 1761793003: Revert of move annotations to canvas virtual (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkAnnotation.h
diff --git a/include/core/SkAnnotation.h b/include/core/SkAnnotation.h
index 35cc2b5d04613fe4e842e8d20d16cb0343f4c303..80503c78d21dad490662cceda0e50de35d4cd3a5 100644
--- a/include/core/SkAnnotation.h
+++ b/include/core/SkAnnotation.h
@@ -8,18 +8,83 @@
#ifndef SkAnnotation_DEFINED
#define SkAnnotation_DEFINED
+#include "SkRefCnt.h"
+#include "SkString.h"
#include "SkTypes.h"
class SkData;
+class SkReadBuffer;
+class SkWriteBuffer;
struct SkPoint;
+
+/**
+ * Experimental class for annotating draws. Do not use directly yet.
+ * Use helper functions at the bottom of this file for now.
+ */
+class SkAnnotation : public SkRefCnt {
+public:
+ virtual ~SkAnnotation();
+
+ static SkAnnotation* Create(const char key[], SkData* value) {
+ return new SkAnnotation(key, value);
+ }
+
+ static SkAnnotation* Create(SkReadBuffer& buffer) { return new SkAnnotation(buffer); }
+
+ /**
+ * Return the data for the specified key, or NULL.
+ */
+ SkData* find(const char key[]) const;
+
+ void writeToBuffer(SkWriteBuffer&) const;
+
+private:
+ SkAnnotation(const char key[], SkData* value);
+ SkAnnotation(SkReadBuffer&);
+
+ SkString fKey;
+ SkData* fData;
+
+ typedef SkRefCnt INHERITED;
+};
+
+/**
+ * Experimental collection of predefined Keys into the Annotation dictionary
+ */
+class SkAnnotationKeys {
+public:
+ /**
+ * Returns the canonical key whose payload is a URL
+ */
+ static const char* URL_Key();
+
+ /**
+ * Returns the canonical key whose payload is the name of a destination to
+ * be defined.
+ */
+ static const char* Define_Named_Dest_Key();
+
+ /**
+ * Returns the canonical key whose payload is the name of a destination to
+ * be linked to.
+ */
+ static const char* Link_Named_Dest_Key();
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Experimental helper functions to use Annotations
+//
+
struct SkRect;
class SkCanvas;
/**
+ * Experimental!
+ *
* Annotate the canvas by associating the specified URL with the
- * specified rectangle (in local coordinates, just like drawRect).
- *
- * If the backend of this canvas does not support annotations, this call is
+ * specified rectangle (in local coordinates, just like drawRect). If the
+ * backend of this canvas does not support annotations, this call is
* safely ignored.
*
* The caller is responsible for managing its ownership of the SkData.
@@ -27,6 +92,8 @@
SK_API void SkAnnotateRectWithURL(SkCanvas*, const SkRect&, SkData*);
/**
+ * Experimental!
+ *
* Annotate the canvas by associating a name with the specified point.
*
* If the backend of this canvas does not support annotations, this call is
@@ -37,6 +104,8 @@
SK_API void SkAnnotateNamedDestination(SkCanvas*, const SkPoint&, SkData*);
/**
+ * Experimental!
+ *
* Annotate the canvas by making the specified rectangle link to a named
* destination.
*
@@ -47,4 +116,5 @@
*/
SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*);
+
#endif
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698