diff options
author | halcanary <halcanary@google.com> | 2015-03-25 11:29:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-25 11:29:18 -0700 |
commit | f41061cc8dc717b63efe75d2357a3176f04153ec (patch) | |
tree | 62b6e16dd3ea56e5bb0bd2eb8c58e74565974c40 /tests/PDFPrimitivesTest.cpp | |
parent | 05245900bf6d49068b1668da1b38890a41e09bc5 (diff) |
SKPDF: refactor pdfcatalog and pdfdocument
SkPDFCatalog:
- remove first-page-specific code (no longer needed, never
used) (e.g. addObject()).
- Make use of SkHashMap for lookups (simplifies code).
- inline all small methods
- emitXrefTable moved to SkPDFDocument.cpp
- no longer store offsets in this data structure (moved to
SkPDFDocument.cpp)
- setFileOffset gone.
- own substitute refs directly.
SkPDFDocument::EmitPDF()
- All sites that call into SkPDFCatalog modified.
- catalog.addObject only called in a single place, after the
resouceSet is built
- offsets moved to local array.
SkPDFPage:
- finalizePage no longer deals with SkPDFCatalog or resource sets.
- GeneratePageTree no longer deals with SkPDFCatalog
SkPDFObjRef
- emitObject respects the substitution map
Unit Tests:
- respect SkPDFCatalog::addObject signature change.
SkTHash:
- #include SkChecksum for SkGoodHash
- Copyright notice added
Review URL: https://codereview.chromium.org/1033543002
Diffstat (limited to 'tests/PDFPrimitivesTest.cpp')
-rw-r--r-- | tests/PDFPrimitivesTest.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp index 189808fdfa..f2bb5f4710 100644 --- a/tests/PDFPrimitivesTest.cpp +++ b/tests/PDFPrimitivesTest.cpp @@ -77,7 +77,7 @@ static void CheckObjectOutput(skiatest::Reporter* reporter, SkPDFObject* obj, static char footer[] = "\nendobj\n"; static size_t footerLen = strlen(footer); - catalog.addObject(obj, false); + catalog.addObject(obj); size_t indirectSize = get_output_size(obj, &catalog, true); REPORTER_ASSERT(reporter, @@ -149,9 +149,9 @@ static void TestCatalog(skiatest::Reporter* reporter) { int1.get()->ref(); SkAutoTUnref<SkPDFInt> int1Again(int1.get()); - catalog.addObject(int1.get(), false); - catalog.addObject(int2.get(), false); - catalog.addObject(int3.get(), false); + catalog.addObject(int1.get()); + catalog.addObject(int2.get()); + catalog.addObject(int3.get()); REPORTER_ASSERT(reporter, catalog.getObjectNumber(int1.get()) == 1); REPORTER_ASSERT(reporter, catalog.getObjectNumber(int2.get()) == 2); @@ -165,8 +165,8 @@ static void TestObjectRef(skiatest::Reporter* reporter) { SkAutoTUnref<SkPDFObjRef> int2ref(new SkPDFObjRef(int2.get())); SkPDFCatalog catalog; - catalog.addObject(int1.get(), false); - catalog.addObject(int2.get(), false); + catalog.addObject(int1.get()); + catalog.addObject(int2.get()); REPORTER_ASSERT(reporter, catalog.getObjectNumber(int1.get()) == 1); REPORTER_ASSERT(reporter, catalog.getObjectNumber(int2.get()) == 2); @@ -186,7 +186,7 @@ static void TestSubstitute(skiatest::Reporter* reporter) { stub->insert("Value", new SkPDFInt(44))->unref(); SkPDFCatalog catalog; - catalog.addObject(proxy.get(), false); + catalog.addObject(proxy.get()); catalog.setSubstitute(proxy.get(), stub.get()); REPORTER_ASSERT(reporter, stub.get() == catalog.getSubstituteObject(proxy)); |