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

Unified Diff: src/pdf/SkPDFDevice.cpp

Issue 1068343003: SkPDF: ResourceDict replaced by factory function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-04-08 (Wednesday) 17:35:39 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | src/pdf/SkPDFFormXObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDevice.cpp
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index f624cb49f97b7bce0096ccb127663e091923b9a3..5167474f106295cc15808104801308d7d256e1eb 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1281,41 +1281,17 @@ void SkPDFDevice::setDrawingArea(DrawingArea drawingArea) {
fDrawingArea = drawingArea;
}
-SkPDFResourceDict* SkPDFDevice::createResourceDict() const {
- SkAutoTUnref<SkPDFResourceDict> resourceDict(SkNEW(SkPDFResourceDict));
- if (fGraphicStateResources.count()) {
- for (int i = 0; i < fGraphicStateResources.count(); i++) {
- resourceDict->insertResourceAsReference(
- SkPDFResourceDict::kExtGState_ResourceType,
- i, fGraphicStateResources[i]);
- }
- }
-
- if (fXObjectResources.count()) {
- for (int i = 0; i < fXObjectResources.count(); i++) {
- resourceDict->insertResourceAsReference(
- SkPDFResourceDict::kXObject_ResourceType,
- i, fXObjectResources[i]);
- }
- }
-
- if (fFontResources.count()) {
- for (int i = 0; i < fFontResources.count(); i++) {
- resourceDict->insertResourceAsReference(
- SkPDFResourceDict::kFont_ResourceType,
- i, fFontResources[i]);
- }
- }
-
- if (fShaderResources.count()) {
- SkAutoTUnref<SkPDFDict> patterns(new SkPDFDict());
- for (int i = 0; i < fShaderResources.count(); i++) {
- resourceDict->insertResourceAsReference(
- SkPDFResourceDict::kPattern_ResourceType,
- i, fShaderResources[i]);
- }
- }
- return resourceDict.detach();
+SkPDFDict* SkPDFDevice::createResourceDict() const {
+ SkTDArray<SkPDFObject*> fonts;
+ fonts.setReserve(fFontResources.count());
+ for (SkPDFFont* font : fFontResources) {
+ fonts.push(font);
+ }
+ return SkPDFResourceDict::Create(
+ &fGraphicStateResources,
+ &fShaderResources,
+ &fXObjectResources,
+ &fonts);
}
const SkTDArray<SkPDFFont*>& SkPDFDevice::getFontResources() const {
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | src/pdf/SkPDFFormXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698