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

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

Issue 1008863002: Revert of Change device creation to see the (optional) layer-paint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 enum_must_match_value); 559 enum_must_match_value);
560 SK_COMPILE_ASSERT(SkPaint::kStrokeAndFill_Style == 2, 560 SK_COMPILE_ASSERT(SkPaint::kStrokeAndFill_Style == 2,
561 enum_must_match_value); 561 enum_must_match_value);
562 fContentStream->writeDecAsText(state.fTextFill); 562 fContentStream->writeDecAsText(state.fTextFill);
563 fContentStream->writeText(" Tr\n"); 563 fContentStream->writeText(" Tr\n");
564 currentEntry()->fTextFill = state.fTextFill; 564 currentEntry()->fTextFill = state.fTextFill;
565 } 565 }
566 } 566 }
567 } 567 }
568 568
569 static bool not_supported_for_layers(const SkPaint& layerPaint) { 569 SkBaseDevice* SkPDFDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) {
570 // PDF does not support image filters, so render them on CPU. 570 // PDF does not support image filters, so render them on CPU.
571 // Note that this rendering is done at "screen" resolution (100dpi), not 571 // Note that this rendering is done at "screen" resolution (100dpi), not
572 // printer resolution. 572 // printer resolution.
573 // FIXME: It may be possible to express some filters natively using PDF 573 // FIXME: It may be possible to express some filters natively using PDF
574 // to improve quality and file size (http://skbug.com/3043) 574 // to improve quality and file size (http://skbug.com/3043)
575 575 if (kImageFilter_Usage == cinfo.fUsage) {
576 // TODO: should we return true if there is a colorfilter?
577 return layerPaint.getImageFilter() != NULL;
578 }
579
580 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint) {
581 if (layerPaint && not_supported_for_layers(*layerPaint)) {
582 return SkBitmapDevice::Create(cinfo.fInfo); 576 return SkBitmapDevice::Create(cinfo.fInfo);
583 } 577 }
584 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); 578 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());
585 return SkPDFDevice::Create(size, fRasterDpi, fCanon); 579 return SkPDFDevice::Create(size, fRasterDpi, fCanon);
586 } 580 }
587 581
588 582
589 struct ContentEntry { 583 struct ContentEntry {
590 GraphicStateEntry fState; 584 GraphicStateEntry fState;
591 SkDynamicMemoryWStream fContent; 585 SkDynamicMemoryWStream fContent;
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 2130
2137 SkAutoTUnref<SkPDFObject> image( 2131 SkAutoTUnref<SkPDFObject> image(
2138 SkPDFCreateImageObject(fCanon, *bitmap, subset)); 2132 SkPDFCreateImageObject(fCanon, *bitmap, subset));
2139 if (!image) { 2133 if (!image) {
2140 return; 2134 return;
2141 } 2135 }
2142 2136
2143 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), 2137 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
2144 &content.entry()->fContent); 2138 &content.entry()->fContent);
2145 } 2139 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698