Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: src/pdf/SkPDFFormXObject.cpp

Issue 19523007: Revert "Adds SkPDFResourceDict class, refactor existing code to use it." (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFPage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
16 #include "SkPDFUtils.h" 15 #include "SkPDFUtils.h"
17 #include "SkStream.h" 16 #include "SkStream.h"
18 #include "SkTypes.h" 17 #include "SkTypes.h"
19 18
20 SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) { 19 SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) {
21 // We don't want to keep around device because we'd have two copies 20 // 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 21 // of content, so reference or copy everything we need (content and
23 // resources). 22 // resources).
24 SkTSet<SkPDFObject*> emptySet; 23 SkTSet<SkPDFObject*> emptySet;
25 SkPDFResourceDict* resourceDict = device->getResourceDict(); 24 device->getResources(emptySet, &fResources, false);
26 resourceDict->getResources(emptySet, &fResources, false);
27 25
28 SkAutoTUnref<SkStream> content(device->content()); 26 SkAutoTUnref<SkStream> content(device->content());
29 setData(content.get()); 27 setData(content.get());
30 28
31 insertName("Type", "XObject"); 29 insertName("Type", "XObject");
32 insertName("Subtype", "Form"); 30 insertName("Subtype", "Form");
33 SkSafeUnref(this->insert("BBox", device->copyMediaBox())); 31 SkSafeUnref(this->insert("BBox", device->copyMediaBox()));
34 insert("Resources", resourceDict); 32 insert("Resources", device->getResourceDict());
35 33
36 // 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
37 // 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
38 // embedded in things like shaders and images. 36 // embedded in things like shaders and images.
39 if (!device->initialTransform().isIdentity()) { 37 if (!device->initialTransform().isIdentity()) {
40 SkMatrix inverse; 38 SkMatrix inverse;
41 if (!device->initialTransform().invert(&inverse)) { 39 if (!device->initialTransform().invert(&inverse)) {
42 // The initial transform should be invertible. 40 // The initial transform should be invertible.
43 SkASSERT(false); 41 SkASSERT(false);
44 inverse.reset(); 42 inverse.reset();
(...skipping 13 matching lines...) Expand all
58 fResources.unrefAll(); 56 fResources.unrefAll();
59 } 57 }
60 58
61 void SkPDFFormXObject::getResources( 59 void SkPDFFormXObject::getResources(
62 const SkTSet<SkPDFObject*>& knownResourceObjects, 60 const SkTSet<SkPDFObject*>& knownResourceObjects,
63 SkTSet<SkPDFObject*>* newResourceObjects) { 61 SkTSet<SkPDFObject*>* newResourceObjects) {
64 GetResourcesHelper(&fResources.toArray(), 62 GetResourcesHelper(&fResources.toArray(),
65 knownResourceObjects, 63 knownResourceObjects,
66 newResourceObjects); 64 newResourceObjects);
67 } 65 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFPage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698