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

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

Issue 1116453002: onCreateDevice -> NULL now means the caller should create its own (bitmap) device (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox Created 5 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
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('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"
11 #include "SkBitmapDevice.h"
12 #include "SkColor.h" 11 #include "SkColor.h"
13 #include "SkClipStack.h" 12 #include "SkClipStack.h"
14 #include "SkData.h" 13 #include "SkData.h"
15 #include "SkDraw.h" 14 #include "SkDraw.h"
16 #include "SkGlyphCache.h" 15 #include "SkGlyphCache.h"
17 #include "SkPaint.h" 16 #include "SkPaint.h"
18 #include "SkPath.h" 17 #include "SkPath.h"
19 #include "SkPathOps.h" 18 #include "SkPathOps.h"
20 #include "SkPDFBitmap.h" 19 #include "SkPDFBitmap.h"
21 #include "SkPDFFont.h" 20 #include "SkPDFFont.h"
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // FIXME: It may be possible to express some filters natively using PDF 571 // FIXME: It may be possible to express some filters natively using PDF
573 // to improve quality and file size (http://skbug.com/3043) 572 // to improve quality and file size (http://skbug.com/3043)
574 573
575 // TODO: should we return true if there is a colorfilter? 574 // TODO: should we return true if there is a colorfilter?
576 return layerPaint.getImageFilter() != NULL; 575 return layerPaint.getImageFilter() != NULL;
577 } 576 }
578 577
579 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint) { 578 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint * layerPaint) {
580 if (cinfo.fForImageFilter || 579 if (cinfo.fForImageFilter ||
581 (layerPaint && not_supported_for_layers(*layerPaint))) { 580 (layerPaint && not_supported_for_layers(*layerPaint))) {
582 return SkBitmapDevice::Create(cinfo.fInfo); 581 return NULL;
583 } 582 }
584 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); 583 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height());
585 return SkPDFDevice::Create(size, fRasterDpi, fCanon); 584 return SkPDFDevice::Create(size, fRasterDpi, fCanon);
586 } 585 }
587 586
588 587
589 struct ContentEntry { 588 struct ContentEntry {
590 GraphicStateEntry fState; 589 GraphicStateEntry fState;
591 SkDynamicMemoryWStream fContent; 590 SkDynamicMemoryWStream fContent;
592 SkAutoTDelete<ContentEntry> fNext; 591 SkAutoTDelete<ContentEntry> fNext;
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 return; 2144 return;
2146 } 2145 }
2147 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); 2146 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap));
2148 if (!image) { 2147 if (!image) {
2149 return; 2148 return;
2150 } 2149 }
2151 2150
2152 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), 2151 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
2153 &content.entry()->fContent); 2152 &content.entry()->fContent);
2154 } 2153 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698