OLD | NEW |
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 "SkPostConfig.h" | 9 #include "SkPostConfig.h" |
10 | 10 |
11 // Sanity check that the values of enum SkPDFResourceType correspond to the | 11 // Sanity check that the values of enum SkPDFResourceType correspond to the |
12 // expected values as defined in the arrays below. | 12 // expected values as defined in the arrays below. |
13 // If these are failing, you may need to update the resource_type_prefixes | 13 // If these are failing, you may need to update the resource_type_prefixes |
14 // and resource_type_names arrays below. | 14 // and resource_type_names arrays below. |
15 SK_COMPILE_ASSERT(SkPDFResourceDict::kExtGState_ResourceType == 0, | 15 static_assert(SkPDFResourceDict::kExtGState_ResourceType == 0, "resource_type_mi
smatch"); |
16 resource_type_mismatch); | 16 static_assert(SkPDFResourceDict::kPattern_ResourceType == 1, "resource_type_mism
atch"); |
17 SK_COMPILE_ASSERT(SkPDFResourceDict::kPattern_ResourceType == 1, | 17 static_assert(SkPDFResourceDict::kXObject_ResourceType == 2, "resource_type_mism
atch"); |
18 resource_type_mismatch); | 18 static_assert(SkPDFResourceDict::kFont_ResourceType == 3, "resource_type_mismatc
h"); |
19 SK_COMPILE_ASSERT(SkPDFResourceDict::kXObject_ResourceType == 2, | |
20 resource_type_mismatch); | |
21 SK_COMPILE_ASSERT(SkPDFResourceDict::kFont_ResourceType == 3, | |
22 resource_type_mismatch); | |
23 | 19 |
24 static const char resource_type_prefixes[] = { | 20 static const char resource_type_prefixes[] = { |
25 'G', | 21 'G', |
26 'P', | 22 'P', |
27 'X', | 23 'X', |
28 'F' | 24 'F' |
29 }; | 25 }; |
30 | 26 |
31 static const char* resource_type_names[] = { | 27 static const char* resource_type_names[] = { |
32 "ExtGState", | 28 "ExtGState", |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 add_subdict(*patternResources, kPattern_ResourceType, dict); | 92 add_subdict(*patternResources, kPattern_ResourceType, dict); |
97 } | 93 } |
98 if (xObjectResources) { | 94 if (xObjectResources) { |
99 add_subdict(*xObjectResources, kXObject_ResourceType, dict); | 95 add_subdict(*xObjectResources, kXObject_ResourceType, dict); |
100 } | 96 } |
101 if (fontResources) { | 97 if (fontResources) { |
102 add_subdict(*fontResources, kFont_ResourceType, dict); | 98 add_subdict(*fontResources, kFont_ResourceType, dict); |
103 } | 99 } |
104 return dict.detach(); | 100 return dict.detach(); |
105 } | 101 } |
OLD | NEW |