| 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 |
| 804 void SkPDFDevice::drawPaint(const SkDraw& d, const SkPaint& paint) { | 818 void SkPDFDevice::drawPaint(const SkDraw& d, const SkPaint& paint) { |
| 805 SkPaint newPaint = paint; | 819 SkPaint newPaint = paint; |
| 806 newPaint.setStyle(SkPaint::kFill_Style); | 820 newPaint.setStyle(SkPaint::kFill_Style); |
| 807 ScopedContentEntry content(this, d, newPaint); | 821 ScopedContentEntry content(this, d, newPaint); |
| 808 internalDrawPaint(newPaint, content.entry()); | 822 internalDrawPaint(newPaint, content.entry()); |
| 809 } | 823 } |
| 810 | 824 |
| 811 void SkPDFDevice::internalDrawPaint(const SkPaint& paint, | 825 void SkPDFDevice::internalDrawPaint(const SkPaint& paint, |
| 812 ContentEntry* contentEntry) { | 826 ContentEntry* contentEntry) { |
| 813 if (!contentEntry) { | 827 if (!contentEntry) { |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 SkAutoTUnref<SkPDFObject> image( | 2203 SkAutoTUnref<SkPDFObject> image( |
| 2190 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); | 2204 SkPDFCreateImageObject(*bitmap, subset, fEncoder)); |
| 2191 if (!image) { | 2205 if (!image) { |
| 2192 return; | 2206 return; |
| 2193 } | 2207 } |
| 2194 | 2208 |
| 2195 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), | 2209 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), |
| 2196 &content.entry()->fContent); | 2210 &content.entry()->fContent); |
| 2197 } | 2211 } |
| 2198 | 2212 |
| OLD | NEW |