OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPDFDevice.h" | 8 #include "SkPDFDevice.h" |
9 | 9 |
10 #include "SkAnnotationKeys.h" | 10 #include "SkAnnotationKeys.h" |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 fInitialTransform.mapRect(&r, linkToDestination.rect); | 1704 fInitialTransform.mapRect(&r, linkToDestination.rect); |
1705 array->appendObject( | 1705 array->appendObject( |
1706 create_link_named_dest(linkToDestination.data.get(), r)); | 1706 create_link_named_dest(linkToDestination.data.get(), r)); |
1707 } | 1707 } |
1708 } | 1708 } |
1709 | 1709 |
1710 void SkPDFDevice::appendDestinations(SkPDFDict* dict, SkPDFObject* page) const { | 1710 void SkPDFDevice::appendDestinations(SkPDFDict* dict, SkPDFObject* page) const { |
1711 for (const NamedDestination& dest : fNamedDestinations) { | 1711 for (const NamedDestination& dest : fNamedDestinations) { |
1712 auto pdfDest = sk_make_sp<SkPDFArray>(); | 1712 auto pdfDest = sk_make_sp<SkPDFArray>(); |
1713 pdfDest->reserve(5); | 1713 pdfDest->reserve(5); |
1714 pdfDest->appendObjRef(sk_sp<SkPDFObject>(SkRef(page))); | 1714 pdfDest->appendObjRef(sk_ref_sp(page)); |
1715 pdfDest->appendName("XYZ"); | 1715 pdfDest->appendName("XYZ"); |
1716 SkPoint p = fInitialTransform.mapXY(dest.point.x(), dest.point.y()); | 1716 SkPoint p = fInitialTransform.mapXY(dest.point.x(), dest.point.y()); |
1717 pdfDest->appendScalar(p.x()); | 1717 pdfDest->appendScalar(p.x()); |
1718 pdfDest->appendScalar(p.y()); | 1718 pdfDest->appendScalar(p.y()); |
1719 pdfDest->appendInt(0); // Leave zoom unchanged | 1719 pdfDest->appendInt(0); // Leave zoom unchanged |
1720 SkString name(static_cast<const char*>(dest.nameData->data())); | 1720 SkString name(static_cast<const char*>(dest.nameData->data())); |
1721 dict->insertObject(name, std::move(pdfDest)); | 1721 dict->insertObject(name, std::move(pdfDest)); |
1722 } | 1722 } |
1723 } | 1723 } |
1724 | 1724 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 pdfimage.reset(SkPDFCreateBitmapObject( | 2326 pdfimage.reset(SkPDFCreateBitmapObject( |
2327 image, fCanon->getPixelSerializer())); | 2327 image, fCanon->getPixelSerializer())); |
2328 if (!pdfimage) { | 2328 if (!pdfimage) { |
2329 return; | 2329 return; |
2330 } | 2330 } |
2331 fCanon->addPDFBitmap(image->uniqueID(), pdfimage.get()); | 2331 fCanon->addPDFBitmap(image->uniqueID(), pdfimage.get()); |
2332 } | 2332 } |
2333 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), | 2333 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), |
2334 &content.entry()->fContent); | 2334 &content.entry()->fContent); |
2335 } | 2335 } |
OLD | NEW |