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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 } | 820 } |
821 break; | 821 break; |
822 default: | 822 default: |
823 SkASSERT(false); | 823 SkASSERT(false); |
824 } | 824 } |
825 } | 825 } |
826 | 826 |
827 static sk_sp<SkPDFDict> create_link_annotation(const SkRect& translatedRect) { | 827 static sk_sp<SkPDFDict> create_link_annotation(const SkRect& translatedRect) { |
828 auto annotation = sk_make_sp<SkPDFDict>("Annot"); | 828 auto annotation = sk_make_sp<SkPDFDict>("Annot"); |
829 annotation->insertName("Subtype", "Link"); | 829 annotation->insertName("Subtype", "Link"); |
830 #ifdef SK_PDF_GENERATE_PDFA | 830 annotation->insertInt("F", 4); // required by ISO 19005 |
831 annotation->insertInt("F", 4); // required by ISO 19005 | |
832 #endif | |
833 | 831 |
834 auto border = sk_make_sp<SkPDFArray>(); | 832 auto border = sk_make_sp<SkPDFArray>(); |
835 border->reserve(3); | 833 border->reserve(3); |
836 border->appendInt(0); // Horizontal corner radius. | 834 border->appendInt(0); // Horizontal corner radius. |
837 border->appendInt(0); // Vertical corner radius. | 835 border->appendInt(0); // Vertical corner radius. |
838 border->appendInt(0); // Width, 0 = no border. | 836 border->appendInt(0); // Width, 0 = no border. |
839 annotation->insertObject("Border", std::move(border)); | 837 annotation->insertObject("Border", std::move(border)); |
840 | 838 |
841 auto rect = sk_make_sp<SkPDFArray>(); | 839 auto rect = sk_make_sp<SkPDFArray>(); |
842 rect->reserve(4); | 840 rect->reserve(4); |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 if (!pdfimage) { | 2137 if (!pdfimage) { |
2140 return; | 2138 return; |
2141 } | 2139 } |
2142 fDocument->serialize(pdfimage); // serialize images early. | 2140 fDocument->serialize(pdfimage); // serialize images early. |
2143 fDocument->canon()->addPDFBitmap(key, pdfimage); | 2141 fDocument->canon()->addPDFBitmap(key, pdfimage); |
2144 } | 2142 } |
2145 // TODO(halcanary): addXObjectResource() should take a sk_sp<SkPDFObject> | 2143 // TODO(halcanary): addXObjectResource() should take a sk_sp<SkPDFObject> |
2146 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), | 2144 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), |
2147 &content.entry()->fContent); | 2145 &content.entry()->fContent); |
2148 } | 2146 } |
OLD | NEW |