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

Unified Diff: tests/AnnotationTest.cpp

Issue 941023005: PDF : New factory function for SkPDFDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase on 07d5947 Created 5 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 | « src/pdf/SkPDFShader.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/AnnotationTest.cpp
diff --git a/tests/AnnotationTest.cpp b/tests/AnnotationTest.cpp
index 0ba3af9e9b84c9f4b2d150b1ccbaf4d6944d2f5f..fc762b1493d65eb648884efdaf296ba48009c990 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());
« no previous file with comments | « src/pdf/SkPDFShader.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698