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 644323006: Fix image filters for PDF backend. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add a comment about rendering quality, and reference appropriate skbug Created 6 years, 2 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/core/SkDeviceImageFilterProxy.h ('k') | tests/PDFPrimitivesTest.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"
11 #include "SkBitmapDevice.h"
11 #include "SkColor.h" 12 #include "SkColor.h"
12 #include "SkClipStack.h" 13 #include "SkClipStack.h"
13 #include "SkData.h" 14 #include "SkData.h"
14 #include "SkDraw.h" 15 #include "SkDraw.h"
15 #include "SkFontHost.h" 16 #include "SkFontHost.h"
16 #include "SkGlyphCache.h" 17 #include "SkGlyphCache.h"
17 #include "SkPaint.h" 18 #include "SkPaint.h"
18 #include "SkPath.h" 19 #include "SkPath.h"
19 #include "SkPathOps.h" 20 #include "SkPathOps.h"
20 #include "SkPDFFont.h" 21 #include "SkPDFFont.h"
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 SK_COMPILE_ASSERT(SkPaint::kStrokeAndFill_Style == 2, 561 SK_COMPILE_ASSERT(SkPaint::kStrokeAndFill_Style == 2,
561 enum_must_match_value); 562 enum_must_match_value);
562 fContentStream->writeDecAsText(state.fTextFill); 563 fContentStream->writeDecAsText(state.fTextFill);
563 fContentStream->writeText(" Tr\n"); 564 fContentStream->writeText(" Tr\n");
564 currentEntry()->fTextFill = state.fTextFill; 565 currentEntry()->fTextFill = state.fTextFill;
565 } 566 }
566 } 567 }
567 } 568 }
568 569
569 SkBaseDevice* SkPDFDevice::onCreateDevice(const SkImageInfo& info, Usage usage) { 570 SkBaseDevice* SkPDFDevice::onCreateDevice(const SkImageInfo& info, Usage usage) {
571 // PDF does not support image filters, so render them on CPU.
572 // Note that this rendering is done at "screen" resolution (100dpi), not
573 // printer resolution.
574 // FIXME: It may be possible to express some filters natively using PDF
575 // to improve quality and file size (http://skbug.com/3043)
576 if (kImageFilter_Usage == usage) {
577 return SkBitmapDevice::Create(info);
578 }
579
570 SkMatrix initialTransform; 580 SkMatrix initialTransform;
571 initialTransform.reset(); 581 initialTransform.reset();
572 SkISize size = SkISize::Make(info.width(), info.height()); 582 SkISize size = SkISize::Make(info.width(), info.height());
573 return SkNEW_ARGS(SkPDFDevice, (size, size, initialTransform)); 583 return SkNEW_ARGS(SkPDFDevice, (size, size, initialTransform));
574 } 584 }
575 585
576 586
577 struct ContentEntry { 587 struct ContentEntry {
578 GraphicStateEntry fState; 588 GraphicStateEntry fState;
579 SkDynamicMemoryWStream fContent; 589 SkDynamicMemoryWStream fContent;
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 SkAutoTUnref<SkPDFObject> image( 2203 SkAutoTUnref<SkPDFObject> image(
2194 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); 2204 SkPDFCreateImageObject(*bitmap, subset, fEncoder));
2195 if (!image) { 2205 if (!image) {
2196 return; 2206 return;
2197 } 2207 }
2198 2208
2199 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), 2209 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
2200 &content.entry()->fContent); 2210 &content.entry()->fContent);
2201 } 2211 }
2202 2212
OLDNEW
« no previous file with comments | « src/core/SkDeviceImageFilterProxy.h ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698