aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/svg/SkSVGDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/svg/SkSVGDevice.cpp')
-rw-r--r--src/svg/SkSVGDevice.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index 4a1f2b750a..6bb971d764 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -7,9 +7,11 @@
#include "SkSVGDevice.h"
+#include "SkAnnotationKeys.h"
#include "SkBase64.h"
#include "SkBitmap.h"
#include "SkChecksum.h"
+#include "SkClipOpPriv.h"
#include "SkClipStack.h"
#include "SkData.h"
#include "SkDraw.h"
@@ -22,7 +24,6 @@
#include "SkTypeface.h"
#include "SkUtils.h"
#include "SkXMLWriter.h"
-#include "SkClipOpPriv.h"
namespace {
@@ -621,6 +622,32 @@ void SkSVGDevice::drawPaint(const SkPaint& paint) {
SkIntToScalar(this->height())));
}
+void SkSVGDevice::drawAnnotation(const SkRect& rect, const char key[], SkData* value) {
+ if (!value) {
+ return;
+ }
+
+ if (!strcmp(SkAnnotationKeys::URL_Key(), key) ||
+ !strcmp(SkAnnotationKeys::Link_Named_Dest_Key(), key)) {
+ this->cs().save();
+ this->cs().clipRect(rect, this->ctm(), kIntersect_SkClipOp, true);
+ SkRect transformedRect = this->cs().bounds(this->getGlobalBounds());
+ this->cs().restore();
+ if (transformedRect.isEmpty()) {
+ return;
+ }
+
+ SkString url(static_cast<const char*>(value->data()), value->size() - 1);
+ AutoElement a("a", fWriter);
+ a.addAttribute("xlink:href", url.c_str());
+ {
+ AutoElement r("rect", fWriter);
+ r.addAttribute("fill-opacity", "0.0");
+ r.addRectAttributes(transformedRect);
+ }
+ }
+}
+
void SkSVGDevice::drawPoints(SkCanvas::PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) {
SkPath path;