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

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

Issue 1107923002: SkPDF: clean up uses of deprecated calls in other SkPDF classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-04-27 (Monday) 09:04:15 EDT Created 5 years, 8 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
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFGraphicState.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"
(...skipping 19 matching lines...) Expand all
30 // We invert the initial transform and apply that to the xobject so that 30 // We invert the initial transform and apply that to the xobject so that
31 // it doesn't get applied twice. We can't just undo it because it's 31 // it doesn't get applied twice. We can't just undo it because it's
32 // embedded in things like shaders and images. 32 // embedded in things like shaders and images.
33 if (!device->initialTransform().isIdentity()) { 33 if (!device->initialTransform().isIdentity()) {
34 SkMatrix inverse; 34 SkMatrix inverse;
35 if (!device->initialTransform().invert(&inverse)) { 35 if (!device->initialTransform().invert(&inverse)) {
36 // The initial transform should be invertible. 36 // The initial transform should be invertible.
37 SkASSERT(false); 37 SkASSERT(false);
38 inverse.reset(); 38 inverse.reset();
39 } 39 }
40 insert("Matrix", SkPDFUtils::MatrixToArray(inverse))->unref(); 40 this->insertObject("Matrix", SkPDFUtils::MatrixToArray(inverse));
41 } 41 }
42 } 42 }
43 43
44 /** 44 /**
45 * Creates a FormXObject from a content stream and associated resources. 45 * Creates a FormXObject from a content stream and associated resources.
46 */ 46 */
47 SkPDFFormXObject::SkPDFFormXObject(SkStream* content, SkRect bbox, 47 SkPDFFormXObject::SkPDFFormXObject(SkStream* content, SkRect bbox,
48 SkPDFDict* resourceDict) { 48 SkPDFDict* resourceDict) {
49 setData(content); 49 setData(content);
50 50
51 SkAutoTUnref<SkPDFArray> bboxArray(SkPDFUtils::RectToArray(bbox)); 51 SkAutoTUnref<SkPDFArray> bboxArray(SkPDFUtils::RectToArray(bbox));
52 init("DeviceRGB", resourceDict, bboxArray); 52 init("DeviceRGB", resourceDict, bboxArray);
53 } 53 }
54 54
55 /** 55 /**
56 * Common initialization code. 56 * Common initialization code.
57 * Note that bbox is unreferenced here, so calling code does not need worry. 57 * Note that bbox is unreferenced here, so calling code does not need worry.
58 */ 58 */
59 void SkPDFFormXObject::init(const char* colorSpace, 59 void SkPDFFormXObject::init(const char* colorSpace,
60 SkPDFDict* resourceDict, SkPDFArray* bbox) { 60 SkPDFDict* resourceDict, SkPDFArray* bbox) {
61 insertName("Type", "XObject"); 61 this->insertName("Type", "XObject");
62 insertName("Subtype", "Form"); 62 this->insertName("Subtype", "Form");
63 insert("Resources", resourceDict); 63 this->insertObject("Resources", SkRef(resourceDict));
64 insert("BBox", bbox); 64 this->insertObject("BBox", SkRef(bbox));
65 65
66 // Right now SkPDFFormXObject is only used for saveLayer, which implies 66 // Right now SkPDFFormXObject is only used for saveLayer, which implies
67 // isolated blending. Do this conditionally if that changes. 67 // isolated blending. Do this conditionally if that changes.
68 SkAutoTUnref<SkPDFDict> group(new SkPDFDict("Group")); 68 SkAutoTUnref<SkPDFDict> group(new SkPDFDict("Group"));
69 group->insertName("S", "Transparency"); 69 group->insertName("S", "Transparency");
70 70
71 if (colorSpace != NULL) { 71 if (colorSpace != NULL) {
72 group->insertName("CS", colorSpace); 72 group->insertName("CS", colorSpace);
73 } 73 }
74 group->insert("I", new SkPDFBool(true))->unref(); // Isolated. 74 group->insertBool("I", true); // Isolated.
75 insert("Group", group.get()); 75 this->insertObject("Group", group.detach());
76 } 76 }
77 77
78 SkPDFFormXObject::~SkPDFFormXObject() {} 78 SkPDFFormXObject::~SkPDFFormXObject() {}
OLDNEW
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFGraphicState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698