OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |