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

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

Issue 1080923004: SkPDF/Device/ImageFilter: Fix ImageFilter fallback code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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') | no next file » | 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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // Note that this rendering is done at "screen" resolution (100dpi), not 570 // Note that this rendering is done at "screen" resolution (100dpi), not
571 // printer resolution. 571 // printer resolution.
572 // FIXME: It may be possible to express some filters natively using PDF 572 // FIXME: It may be possible to express some filters natively using PDF
573 // to improve quality and file size (http://skbug.com/3043) 573 // to improve quality and file size (http://skbug.com/3043)
574 574
575 // TODO: should we return true if there is a colorfilter? 575 // TODO: should we return true if there is a colorfilter?
576 return layerPaint.getImageFilter() != NULL; 576 return layerPaint.getImageFilter() != NULL;
577 } 577 }
578 578
579 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint) { 579 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint) {
580 if (layerPaint && not_supported_for_layers(*layerPaint)) { 580 if (cinfo.fForImageFilter ||
581 (layerPaint && not_supported_for_layers(*layerPaint))) {
581 return SkBitmapDevice::Create(cinfo.fInfo); 582 return SkBitmapDevice::Create(cinfo.fInfo);
582 } 583 }
583 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); 584 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());
584 return SkPDFDevice::Create(size, fRasterDpi, fCanon); 585 return SkPDFDevice::Create(size, fRasterDpi, fCanon);
585 } 586 }
586 587
587 588
588 struct ContentEntry { 589 struct ContentEntry {
589 GraphicStateEntry fState; 590 GraphicStateEntry fState;
590 SkDynamicMemoryWStream fContent; 591 SkDynamicMemoryWStream fContent;
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 return; 2144 return;
2144 } 2145 }
2145 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); 2146 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap));
2146 if (!image) { 2147 if (!image) {
2147 return; 2148 return;
2148 } 2149 }
2149 2150
2150 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), 2151 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
2151 &content.entry()->fContent); 2152 &content.entry()->fContent);
2152 } 2153 }
OLDNEW
« no previous file with comments | « src/core/SkDeviceImageFilterProxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698