diff options
author | halcanary <halcanary@google.com> | 2015-02-20 06:17:26 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-20 06:17:26 -0800 |
commit | a1f1ee98a1f6d0770f6243270ca2f0e6c92efaba (patch) | |
tree | 427609a03b889602589a698834b96ea0035e6e8a /tests/AnnotationTest.cpp | |
parent | 07d5947b886bef06621e830e9f8bf253f9bad703 (diff) |
PDF : New factory function for SkPDFDevice
SkPDFDevice now has factory function that matches what callers need.
Review URL: https://codereview.chromium.org/941023005
Diffstat (limited to 'tests/AnnotationTest.cpp')
-rw-r--r-- | tests/AnnotationTest.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/AnnotationTest.cpp b/tests/AnnotationTest.cpp index 0ba3af9e9b..fc762b1493 100644 --- a/tests/AnnotationTest.cpp +++ b/tests/AnnotationTest.cpp @@ -8,6 +8,7 @@ #include "SkAnnotation.h" #include "SkCanvas.h" #include "SkData.h" +#include "SkPDFCanon.h" #include "SkPDFDevice.h" #include "SkPDFDocument.h" #include "Test.h" @@ -41,10 +42,9 @@ DEF_TEST(Annotation_NoDraw, reporter) { DEF_TEST(Annotation_PdfLink, reporter) { SkISize size = SkISize::Make(612, 792); - SkMatrix initialTransform; - initialTransform.reset(); - SkPDFDevice device(size, size, initialTransform); - SkCanvas canvas(&device); + SkPDFCanon canon; + SkAutoTUnref<SkPDFDevice> device(SkPDFDevice::Create(size, 72.0f, &canon)); + SkCanvas canvas(device.get()); SkRect r = SkRect::MakeXYWH(SkIntToScalar(72), SkIntToScalar(72), SkIntToScalar(288), SkIntToScalar(72)); @@ -52,7 +52,7 @@ DEF_TEST(Annotation_PdfLink, reporter) { SkAnnotateRectWithURL(&canvas, r, data.get()); SkPDFDocument doc; - doc.appendPage(&device); + doc.appendPage(device.get()); SkDynamicMemoryWStream outStream; doc.emitPDF(&outStream); SkAutoDataUnref out(outStream.copyToData()); @@ -63,17 +63,16 @@ DEF_TEST(Annotation_PdfLink, reporter) { DEF_TEST(Annotation_NamedDestination, reporter) { SkISize size = SkISize::Make(612, 792); - SkMatrix initialTransform; - initialTransform.reset(); - SkPDFDevice device(size, size, initialTransform); - SkCanvas canvas(&device); + SkPDFCanon canon; + SkAutoTUnref<SkPDFDevice> device(SkPDFDevice::Create(size, 72.0f, &canon)); + SkCanvas canvas(device.get()); SkPoint p = SkPoint::Make(SkIntToScalar(72), SkIntToScalar(72)); SkAutoDataUnref data(SkData::NewWithCString("example")); SkAnnotateNamedDestination(&canvas, p, data.get()); SkPDFDocument doc; - doc.appendPage(&device); + doc.appendPage(device.get()); SkDynamicMemoryWStream outStream; doc.emitPDF(&outStream); SkAutoDataUnref out(outStream.copyToData()); |