OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkPDFFormXObject.h" | 10 #include "SkPDFFormXObject.h" |
11 | 11 |
12 #include "SkMatrix.h" | 12 #include "SkMatrix.h" |
13 #include "SkPDFCatalog.h" | 13 #include "SkPDFCatalog.h" |
14 #include "SkPDFDevice.h" | 14 #include "SkPDFDevice.h" |
15 #include "SkPDFResourceDict.h" | 15 #include "SkPDFResourceDict.h" |
16 #include "SkPDFUtils.h" | 16 #include "SkPDFUtils.h" |
17 #include "SkStream.h" | 17 #include "SkStream.h" |
18 #include "SkTypes.h" | 18 #include "SkTypes.h" |
19 | 19 |
20 SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) { | 20 SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) { |
21 // We don't want to keep around device because we'd have two copies | 21 // We don't want to keep around device because we'd have two copies |
22 // of content, so reference or copy everything we need (content and | 22 // of content, so reference or copy everything we need (content and |
23 // resources). | 23 // resources). |
24 SkTSet<SkPDFObject*> emptySet; | 24 SkTSet<SkPDFObject*> emptySet; |
25 SkPDFResourceDict* resourceDict = device->getResourceDict(); | 25 SkPDFResourceDict* resourceDict = device->getResourceDict(); |
26 resourceDict->getReferencedResources(emptySet, &fResources, false); | 26 resourceDict->getReferencedResources(emptySet, &fResources, false); |
27 | 27 |
28 SkAutoTUnref<SkStream> content(device->content()); | 28 SkAutoTDelete<SkStream> content(device->content()); |
29 setData(content.get()); | 29 setData(content.get()); |
30 | 30 |
31 SkAutoTUnref<SkPDFArray> bboxArray(device->copyMediaBox()); | 31 SkAutoTUnref<SkPDFArray> bboxArray(device->copyMediaBox()); |
32 init(NULL, resourceDict, bboxArray); | 32 init(NULL, resourceDict, bboxArray); |
33 | 33 |
34 // We invert the initial transform and apply that to the xobject so that | 34 // We invert the initial transform and apply that to the xobject so that |
35 // it doesn't get applied twice. We can't just undo it because it's | 35 // it doesn't get applied twice. We can't just undo it because it's |
36 // embedded in things like shaders and images. | 36 // embedded in things like shaders and images. |
37 if (!device->initialTransform().isIdentity()) { | 37 if (!device->initialTransform().isIdentity()) { |
38 SkMatrix inverse; | 38 SkMatrix inverse; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 fResources.unrefAll(); | 86 fResources.unrefAll(); |
87 } | 87 } |
88 | 88 |
89 void SkPDFFormXObject::getResources( | 89 void SkPDFFormXObject::getResources( |
90 const SkTSet<SkPDFObject*>& knownResourceObjects, | 90 const SkTSet<SkPDFObject*>& knownResourceObjects, |
91 SkTSet<SkPDFObject*>* newResourceObjects) { | 91 SkTSet<SkPDFObject*>* newResourceObjects) { |
92 GetResourcesHelper(&fResources.toArray(), | 92 GetResourcesHelper(&fResources.toArray(), |
93 knownResourceObjects, | 93 knownResourceObjects, |
94 newResourceObjects); | 94 newResourceObjects); |
95 } | 95 } |
OLD | NEW |