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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 // TODO(vandebo) change pageSize to SkSize. | 738 // TODO(vandebo) change pageSize to SkSize. |
739 SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize, | 739 SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize, |
740 const SkMatrix& initialTransform) | 740 const SkMatrix& initialTransform) |
741 : SkBitmapDevice(makeContentBitmap(contentSize, &initialTransform)), | 741 : SkBitmapDevice(makeContentBitmap(contentSize, &initialTransform)), |
742 fPageSize(pageSize), | 742 fPageSize(pageSize), |
743 fContentSize(contentSize), | 743 fContentSize(contentSize), |
744 fLastContentEntry(NULL), | 744 fLastContentEntry(NULL), |
745 fLastMarginContentEntry(NULL), | 745 fLastMarginContentEntry(NULL), |
746 fClipStack(NULL), | 746 fClipStack(NULL), |
747 fEncoder(NULL), | 747 fEncoder(NULL), |
748 fRasterDpi(SkFloatToScalar(72.0f)) { | 748 fRasterDpi(72.0f) { |
749 // Just report that PDF does not supports perspective in the | 749 // Just report that PDF does not supports perspective in the |
750 // initial transform. | 750 // initial transform. |
751 NOT_IMPLEMENTED(initialTransform.hasPerspective(), true); | 751 NOT_IMPLEMENTED(initialTransform.hasPerspective(), true); |
752 | 752 |
753 // Skia generally uses the top left as the origin but PDF natively has the | 753 // Skia generally uses the top left as the origin but PDF natively has the |
754 // origin at the bottom left. This matrix corrects for that. But that only | 754 // origin at the bottom left. This matrix corrects for that. But that only |
755 // needs to be done once, we don't do it when layering. | 755 // needs to be done once, we don't do it when layering. |
756 fInitialTransform.setTranslate(0, SkIntToScalar(pageSize.fHeight)); | 756 fInitialTransform.setTranslate(0, SkIntToScalar(pageSize.fHeight)); |
757 fInitialTransform.preScale(SK_Scalar1, -SK_Scalar1); | 757 fInitialTransform.preScale(SK_Scalar1, -SK_Scalar1); |
758 fInitialTransform.preConcat(initialTransform); | 758 fInitialTransform.preConcat(initialTransform); |
(...skipping 10 matching lines...) Expand all Loading... |
769 const SkRegion& existingClipRegion) | 769 const SkRegion& existingClipRegion) |
770 : SkBitmapDevice(makeContentBitmap(layerSize, NULL)), | 770 : SkBitmapDevice(makeContentBitmap(layerSize, NULL)), |
771 fPageSize(layerSize), | 771 fPageSize(layerSize), |
772 fContentSize(layerSize), | 772 fContentSize(layerSize), |
773 fExistingClipStack(existingClipStack), | 773 fExistingClipStack(existingClipStack), |
774 fExistingClipRegion(existingClipRegion), | 774 fExistingClipRegion(existingClipRegion), |
775 fLastContentEntry(NULL), | 775 fLastContentEntry(NULL), |
776 fLastMarginContentEntry(NULL), | 776 fLastMarginContentEntry(NULL), |
777 fClipStack(NULL), | 777 fClipStack(NULL), |
778 fEncoder(NULL), | 778 fEncoder(NULL), |
779 fRasterDpi(SkFloatToScalar(72.0f)) { | 779 fRasterDpi(72.0f) { |
780 fInitialTransform.reset(); | 780 fInitialTransform.reset(); |
781 this->init(); | 781 this->init(); |
782 } | 782 } |
783 | 783 |
784 SkPDFDevice::~SkPDFDevice() { | 784 SkPDFDevice::~SkPDFDevice() { |
785 this->cleanUp(true); | 785 this->cleanUp(true); |
786 } | 786 } |
787 | 787 |
788 void SkPDFDevice::init() { | 788 void SkPDFDevice::init() { |
789 fAnnotations = NULL; | 789 fAnnotations = NULL; |
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2304 } | 2304 } |
2305 | 2305 |
2306 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, | 2306 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, |
2307 SkCanvas::Config8888) { | 2307 SkCanvas::Config8888) { |
2308 return false; | 2308 return false; |
2309 } | 2309 } |
2310 | 2310 |
2311 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { | 2311 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { |
2312 return false; | 2312 return false; |
2313 } | 2313 } |
OLD | NEW |