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

Unified Diff: tests/PDFDocumentTest.cpp

Issue 1916093002: SkDocument/PDF: new API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-26 (Tuesday) 15:55:33 EDT Created 4 years, 8 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 | « tests/CanvasTest.cpp ('k') | tests/PDFInvalidBitmapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PDFDocumentTest.cpp
diff --git a/tests/PDFDocumentTest.cpp b/tests/PDFDocumentTest.cpp
index 98d1864df1d4cea18cf4397d12fe54dc43403990..b763742b0665281181939778099942186c7fbe47 100644
--- a/tests/PDFDocumentTest.cpp
+++ b/tests/PDFDocumentTest.cpp
@@ -16,7 +16,7 @@
static void test_empty(skiatest::Reporter* reporter) {
SkDynamicMemoryWStream stream;
- SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream));
+ sk_sp<SkDocument> doc(SkDocument::MakePDF(&stream));
doc->close();
@@ -25,7 +25,7 @@ static void test_empty(skiatest::Reporter* reporter) {
static void test_abort(skiatest::Reporter* reporter) {
SkDynamicMemoryWStream stream;
- SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream));
+ sk_sp<SkDocument> doc(SkDocument::MakePDF(&stream));
SkCanvas* canvas = doc->beginPage(100, 100);
canvas->drawColor(SK_ColorRED);
@@ -50,7 +50,7 @@ static void test_abortWithFile(skiatest::Reporter* reporter) {
// Make sure doc's destructor is called to flush.
{
- SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(path.c_str()));
+ sk_sp<SkDocument> doc(SkDocument::MakePDF(path.c_str()));
SkCanvas* canvas = doc->beginPage(100, 100);
canvas->drawColor(SK_ColorRED);
@@ -76,7 +76,7 @@ static void test_file(skiatest::Reporter* reporter) {
SkString path = SkOSPath::Join(tmpDir.c_str(), "file.pdf");
- SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(path.c_str()));
+ sk_sp<SkDocument> doc(SkDocument::MakePDF(path.c_str()));
SkCanvas* canvas = doc->beginPage(100, 100);
@@ -94,7 +94,7 @@ static void test_file(skiatest::Reporter* reporter) {
static void test_close(skiatest::Reporter* reporter) {
SkDynamicMemoryWStream stream;
- SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream));
+ sk_sp<SkDocument> doc(SkDocument::MakePDF(&stream));
SkCanvas* canvas = doc->beginPage(100, 100);
canvas->drawColor(SK_ColorRED);
@@ -132,13 +132,13 @@ class JPEGSerializer final : public SkPixelSerializer {
size_t count_bytes(const SkBitmap& bm, bool useDCT) {
SkDynamicMemoryWStream stream;
- SkAutoTUnref<SkDocument> doc;
+ sk_sp<SkDocument> doc;
if (useDCT) {
- SkAutoTUnref<SkPixelSerializer> serializer(new JPEGSerializer);
- doc.reset(SkDocument::CreatePDF(
- &stream, SK_ScalarDefaultRasterDPI, serializer));
+ doc = SkDocument::MakePDF(&stream, SK_ScalarDefaultRasterDPI,
+ SkDocument::PDFMetadata(),
+ sk_make_sp<JPEGSerializer>(), false);
} else {
- doc.reset(SkDocument::CreatePDF(&stream));
+ doc = SkDocument::MakePDF(&stream);
}
SkCanvas* canvas = doc->beginPage(64, 64);
canvas->drawBitmap(bm, 0, 0);
@@ -159,7 +159,7 @@ DEF_TEST(document_dct_encoder, r) {
DEF_TEST(document_skbug_4734, r) {
REQUIRE_PDF_DOCUMENT(document_skbug_4734, r);
SkDynamicMemoryWStream stream;
- SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream));
+ sk_sp<SkDocument> doc(SkDocument::MakePDF(&stream));
SkCanvas* canvas = doc->beginPage(64, 64);
canvas->scale(10000.0f, 10000.0f);
canvas->translate(20.0f, 10.0f);
« no previous file with comments | « tests/CanvasTest.cpp ('k') | tests/PDFInvalidBitmapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698