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

Side by Side Diff: src/pdf/SkPDFDevice.cpp

Issue 1763143002: WIP RasterCanvasLayerAllocator (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: test and some further work Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // PDF does not support image filters, so render them on CPU. 537 // PDF does not support image filters, so render them on CPU.
538 // Note that this rendering is done at "screen" resolution (100dpi), not 538 // Note that this rendering is done at "screen" resolution (100dpi), not
539 // printer resolution. 539 // printer resolution.
540 // TODO: It may be possible to express some filters natively using PDF 540 // TODO: It may be possible to express some filters natively using PDF
541 // to improve quality and file size (https://bug.skia.org/3043) 541 // to improve quality and file size (https://bug.skia.org/3043)
542 542
543 // TODO: should we return true if there is a colorfilter? 543 // TODO: should we return true if there is a colorfilter?
544 return layerPaint.getImageFilter() != nullptr; 544 return layerPaint.getImageFilter() != nullptr;
545 } 545 }
546 546
547 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint) { 547 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint,
548 SkRasterCanvasLayerAllocator*) {
548 if (cinfo.fForImageFilter || 549 if (cinfo.fForImageFilter ||
549 (layerPaint && not_supported_for_layers(*layerPaint))) { 550 (layerPaint && not_supported_for_layers(*layerPaint))) {
550 return nullptr; 551 return nullptr;
551 } 552 }
552 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); 553 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());
553 return SkPDFDevice::Create(size, fRasterDpi, fDocument); 554 return SkPDFDevice::Create(size, fRasterDpi, fDocument);
554 } 555 }
555 556
556 SkPDFCanon* SkPDFDevice::getCanon() const { return fDocument->canon(); } 557 SkPDFCanon* SkPDFDevice::getCanon() const { return fDocument->canon(); }
557 558
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 if (!pdfimage) { 2139 if (!pdfimage) {
2139 return; 2140 return;
2140 } 2141 }
2141 fDocument->serialize(pdfimage); // serialize images early. 2142 fDocument->serialize(pdfimage); // serialize images early.
2142 fDocument->canon()->addPDFBitmap(key, pdfimage); 2143 fDocument->canon()->addPDFBitmap(key, pdfimage);
2143 } 2144 }
2144 // TODO(halcanary): addXObjectResource() should take a sk_sp<SkPDFObject> 2145 // TODO(halcanary): addXObjectResource() should take a sk_sp<SkPDFObject>
2145 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), 2146 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()),
2146 &content.entry()->fContent); 2147 &content.entry()->fContent);
2147 } 2148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698