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

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

Issue 2330503002: work in progress (Closed)
Patch Set: Created 4 years, 3 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/SkPDFResourceDict.h ('k') | src/pdf/SkScopeExit.h » ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkPDFResourceDict.h" 8 #include "SkPDFResourceDict.h"
9 #include "SkPDFTypes.h" 9 #include "SkPDFTypes.h"
10 #include "SkPostConfig.h" 10 #include "SkPostConfig.h"
(...skipping 14 matching lines...) Expand all
25 'F' 25 'F'
26 }; 26 };
27 27
28 static const char* resource_type_names[] = { 28 static const char* resource_type_names[] = {
29 "ExtGState", 29 "ExtGState",
30 "Pattern", 30 "Pattern",
31 "XObject", 31 "XObject",
32 "Font" 32 "Font"
33 }; 33 };
34 34
35 static char get_resource_type_prefix( 35 char SkPDFResourceDict::GetResourceTypePrefix(
36 SkPDFResourceDict::SkPDFResourceType type) { 36 SkPDFResourceDict::SkPDFResourceType type) {
37 SkASSERT(type >= 0); 37 SkASSERT(type >= 0);
38 SkASSERT(type < SkPDFResourceDict::kResourceTypeCount); 38 SkASSERT(type < SkPDFResourceDict::kResourceTypeCount);
39 39
40 return resource_type_prefixes[type]; 40 return resource_type_prefixes[type];
41 } 41 }
42 42
43 static const char* get_resource_type_name( 43 static const char* get_resource_type_name(
44 SkPDFResourceDict::SkPDFResourceType type) { 44 SkPDFResourceDict::SkPDFResourceType type) {
45 SkASSERT(type >= 0); 45 SkASSERT(type >= 0);
46 SkASSERT(type < SK_ARRAY_COUNT(resource_type_names)); 46 SkASSERT(type < SK_ARRAY_COUNT(resource_type_names));
47 47
48 return resource_type_names[type]; 48 return resource_type_names[type];
49 } 49 }
50 50
51 SkString SkPDFResourceDict::getResourceName( 51 SkString SkPDFResourceDict::getResourceName(
52 SkPDFResourceDict::SkPDFResourceType type, int key) { 52 SkPDFResourceDict::SkPDFResourceType type, int key) {
53 SkString keyString; 53 return SkStringPrintf("%c%d", SkPDFResourceDict::GetResourceTypePrefix(type) , key);
54 keyString.printf("%c%d", get_resource_type_prefix(type), key);
55 return keyString;
56 } 54 }
57 55
58 static void add_subdict( 56 static void add_subdict(
59 const SkTDArray<SkPDFObject*>& resourceList, 57 const SkTDArray<SkPDFObject*>& resourceList,
60 SkPDFResourceDict::SkPDFResourceType type, 58 SkPDFResourceDict::SkPDFResourceType type,
61 SkPDFDict* dst) { 59 SkPDFDict* dst) {
62 if (0 == resourceList.count()) { 60 if (0 == resourceList.count()) {
63 return; 61 return;
64 } 62 }
65 auto resources = sk_make_sp<SkPDFDict>(); 63 auto resources = sk_make_sp<SkPDFDict>();
(...skipping 27 matching lines...) Expand all
93 add_subdict(*patternResources, kPattern_ResourceType, dict.get()); 91 add_subdict(*patternResources, kPattern_ResourceType, dict.get());
94 } 92 }
95 if (xObjectResources) { 93 if (xObjectResources) {
96 add_subdict(*xObjectResources, kXObject_ResourceType, dict.get()); 94 add_subdict(*xObjectResources, kXObject_ResourceType, dict.get());
97 } 95 }
98 if (fontResources) { 96 if (fontResources) {
99 add_subdict(*fontResources, kFont_ResourceType, dict.get()); 97 add_subdict(*fontResources, kFont_ResourceType, dict.get());
100 } 98 }
101 return dict; 99 return dict;
102 } 100 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFResourceDict.h ('k') | src/pdf/SkScopeExit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698