Chromium Code Reviews| 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" |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 } | 720 } |
| 721 | 721 |
| 722 // TODO(vandebo) change pageSize to SkSize. | 722 // TODO(vandebo) change pageSize to SkSize. |
| 723 SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize, | 723 SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize, |
| 724 const SkMatrix& initialTransform) | 724 const SkMatrix& initialTransform) |
| 725 : fPageSize(pageSize) | 725 : fPageSize(pageSize) |
| 726 , fContentSize(contentSize) | 726 , fContentSize(contentSize) |
| 727 , fLastContentEntry(NULL) | 727 , fLastContentEntry(NULL) |
| 728 , fLastMarginContentEntry(NULL) | 728 , fLastMarginContentEntry(NULL) |
| 729 , fClipStack(NULL) | 729 , fClipStack(NULL) |
| 730 , fEncoder(NULL) | |
|
mtklein
2015/02/20 03:36:13
So... this was just always NULL?
hal.canary
2015/02/20 12:52:57
The constructor never sets it. You had to call ->
| |
| 731 , fRasterDpi(72.0f) | 730 , fRasterDpi(72.0f) |
| 732 { | 731 { |
| 733 const SkImageInfo info = make_content_info(contentSize, &initialTransform); | 732 const SkImageInfo info = make_content_info(contentSize, &initialTransform); |
| 734 | 733 |
| 735 // Just report that PDF does not supports perspective in the | 734 // Just report that PDF does not supports perspective in the |
| 736 // initial transform. | 735 // initial transform. |
| 737 NOT_IMPLEMENTED(initialTransform.hasPerspective(), true); | 736 NOT_IMPLEMENTED(initialTransform.hasPerspective(), true); |
| 738 | 737 |
| 739 // Skia generally uses the top left as the origin but PDF natively has the | 738 // Skia generally uses the top left as the origin but PDF natively has the |
| 740 // origin at the bottom left. This matrix corrects for that. But that only | 739 // origin at the bottom left. This matrix corrects for that. But that only |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 753 SkPDFDevice::SkPDFDevice(const SkISize& layerSize, | 752 SkPDFDevice::SkPDFDevice(const SkISize& layerSize, |
| 754 const SkClipStack& existingClipStack, | 753 const SkClipStack& existingClipStack, |
| 755 const SkRegion& existingClipRegion) | 754 const SkRegion& existingClipRegion) |
| 756 : fPageSize(layerSize) | 755 : fPageSize(layerSize) |
| 757 , fContentSize(layerSize) | 756 , fContentSize(layerSize) |
| 758 , fExistingClipStack(existingClipStack) | 757 , fExistingClipStack(existingClipStack) |
| 759 , fExistingClipRegion(existingClipRegion) | 758 , fExistingClipRegion(existingClipRegion) |
| 760 , fLastContentEntry(NULL) | 759 , fLastContentEntry(NULL) |
| 761 , fLastMarginContentEntry(NULL) | 760 , fLastMarginContentEntry(NULL) |
| 762 , fClipStack(NULL) | 761 , fClipStack(NULL) |
| 763 , fEncoder(NULL) | |
| 764 , fRasterDpi(72.0f) | 762 , fRasterDpi(72.0f) |
| 765 { | 763 { |
| 766 fInitialTransform.reset(); | 764 fInitialTransform.reset(); |
| 767 fLegacyBitmap.setInfo(make_content_info(layerSize, NULL)); | 765 fLegacyBitmap.setInfo(make_content_info(layerSize, NULL)); |
| 768 | 766 |
| 769 this->init(); | 767 this->init(); |
| 770 } | 768 } |
| 771 | 769 |
| 772 SkPDFDevice::~SkPDFDevice() { | 770 SkPDFDevice::~SkPDFDevice() { |
| 773 this->cleanUp(true); | 771 this->cleanUp(true); |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2171 shape.addRect(SkRect::MakeWH(SkIntToScalar(subset.width()), | 2169 shape.addRect(SkRect::MakeWH(SkIntToScalar(subset.width()), |
| 2172 SkIntToScalar( subset.height()))); | 2170 SkIntToScalar( subset.height()))); |
| 2173 shape.transform(matrix); | 2171 shape.transform(matrix); |
| 2174 content.setShape(shape); | 2172 content.setShape(shape); |
| 2175 } | 2173 } |
| 2176 if (!content.needSource()) { | 2174 if (!content.needSource()) { |
| 2177 return; | 2175 return; |
| 2178 } | 2176 } |
| 2179 | 2177 |
| 2180 SkAutoTUnref<SkPDFObject> image( | 2178 SkAutoTUnref<SkPDFObject> image( |
| 2181 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); | 2179 SkPDFCreateImageObject(*bitmap, subset)); |
| 2182 if (!image) { | 2180 if (!image) { |
| 2183 return; | 2181 return; |
| 2184 } | 2182 } |
| 2185 | 2183 |
| 2186 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), | 2184 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), |
| 2187 &content.entry()->fContent); | 2185 &content.entry()->fContent); |
| 2188 } | 2186 } |
| 2189 | 2187 |
| OLD | NEW |