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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 fShaderResources.unrefAll(); | 794 fShaderResources.unrefAll(); |
795 SkSafeUnref(fAnnotations); | 795 SkSafeUnref(fAnnotations); |
796 SkSafeUnref(fResourceDict); | 796 SkSafeUnref(fResourceDict); |
797 fNamedDestinations.deleteAll(); | 797 fNamedDestinations.deleteAll(); |
798 | 798 |
799 if (clearFontUsage) { | 799 if (clearFontUsage) { |
800 fFontGlyphUsage->reset(); | 800 fFontGlyphUsage->reset(); |
801 } | 801 } |
802 } | 802 } |
803 | 803 |
804 void SkPDFDevice::clear(SkColor color) { | |
805 this->cleanUp(true); | |
806 this->init(); | |
807 | |
808 SkPaint paint; | |
809 paint.setColor(color); | |
810 paint.setStyle(SkPaint::kFill_Style); | |
811 SkMatrix identity; | |
812 identity.reset(); | |
813 ScopedContentEntry content(this, &fExistingClipStack, fExistingClipRegion, | |
814 identity, paint); | |
815 internalDrawPaint(paint, content.entry()); | |
816 } | |
817 | |
818 void SkPDFDevice::drawPaint(const SkDraw& d, const SkPaint& paint) { | 804 void SkPDFDevice::drawPaint(const SkDraw& d, const SkPaint& paint) { |
819 SkPaint newPaint = paint; | 805 SkPaint newPaint = paint; |
820 newPaint.setStyle(SkPaint::kFill_Style); | 806 newPaint.setStyle(SkPaint::kFill_Style); |
821 ScopedContentEntry content(this, d, newPaint); | 807 ScopedContentEntry content(this, d, newPaint); |
822 internalDrawPaint(newPaint, content.entry()); | 808 internalDrawPaint(newPaint, content.entry()); |
823 } | 809 } |
824 | 810 |
825 void SkPDFDevice::internalDrawPaint(const SkPaint& paint, | 811 void SkPDFDevice::internalDrawPaint(const SkPaint& paint, |
826 ContentEntry* contentEntry) { | 812 ContentEntry* contentEntry) { |
827 if (!contentEntry) { | 813 if (!contentEntry) { |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2203 SkAutoTUnref<SkPDFObject> image( | 2189 SkAutoTUnref<SkPDFObject> image( |
2204 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); | 2190 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); |
2205 if (!image) { | 2191 if (!image) { |
2206 return; | 2192 return; |
2207 } | 2193 } |
2208 | 2194 |
2209 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), | 2195 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), |
2210 &content.entry()->fContent); | 2196 &content.entry()->fContent); |
2211 } | 2197 } |
2212 | 2198 |
OLD | NEW |