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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // Note that this rendering is done at "screen" resolution (100dpi), not | 536 // Note that this rendering is done at "screen" resolution (100dpi), not |
537 // printer resolution. | 537 // printer resolution. |
538 // TODO: It may be possible to express some filters natively using PDF | 538 // TODO: It may be possible to express some filters natively using PDF |
539 // to improve quality and file size (https://bug.skia.org/3043) | 539 // to improve quality and file size (https://bug.skia.org/3043) |
540 | 540 |
541 // TODO: should we return true if there is a colorfilter? | 541 // TODO: should we return true if there is a colorfilter? |
542 return layerPaint.getImageFilter() != nullptr; | 542 return layerPaint.getImageFilter() != nullptr; |
543 } | 543 } |
544 | 544 |
545 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
* layerPaint) { | 545 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
* layerPaint) { |
546 if (cinfo.fForImageFilter || | 546 if (layerPaint && not_supported_for_layers(*layerPaint)) { |
547 (layerPaint && not_supported_for_layers(*layerPaint))) { | |
548 return nullptr; | 547 return nullptr; |
549 } | 548 } |
550 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); | 549 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); |
551 return SkPDFDevice::Create(size, fRasterDpi, fDocument); | 550 return SkPDFDevice::Create(size, fRasterDpi, fDocument); |
552 } | 551 } |
553 | 552 |
554 SkPDFCanon* SkPDFDevice::getCanon() const { return fDocument->canon(); } | 553 SkPDFCanon* SkPDFDevice::getCanon() const { return fDocument->canon(); } |
555 | 554 |
556 | 555 |
557 | 556 |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 if (!pdfimage) { | 2121 if (!pdfimage) { |
2123 return; | 2122 return; |
2124 } | 2123 } |
2125 fDocument->serialize(pdfimage); // serialize images early. | 2124 fDocument->serialize(pdfimage); // serialize images early. |
2126 fDocument->canon()->addPDFBitmap(key, pdfimage); | 2125 fDocument->canon()->addPDFBitmap(key, pdfimage); |
2127 } | 2126 } |
2128 // TODO(halcanary): addXObjectResource() should take a sk_sp<SkPDFObject> | 2127 // TODO(halcanary): addXObjectResource() should take a sk_sp<SkPDFObject> |
2129 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), | 2128 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), |
2130 &content.entry()->fContent); | 2129 &content.entry()->fContent); |
2131 } | 2130 } |
OLD | NEW |