OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkPDFFormXObject.h" | 8 #include "SkPDFFormXObject.h" |
9 #include "SkPDFGraphicState.h" | 9 #include "SkPDFGraphicState.h" |
10 #include "SkPDFUtils.h" | 10 #include "SkPDFUtils.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 return CanonicalPaints()[index].fGraphicState; | 107 return CanonicalPaints()[index].fGraphicState; |
108 } | 108 } |
109 GSCanonicalEntry newEntry(new SkPDFGraphicState(paint)); | 109 GSCanonicalEntry newEntry(new SkPDFGraphicState(paint)); |
110 CanonicalPaints().push(newEntry); | 110 CanonicalPaints().push(newEntry); |
111 return newEntry.fGraphicState; | 111 return newEntry.fGraphicState; |
112 } | 112 } |
113 | 113 |
114 // static | 114 // static |
115 SkPDFObject* SkPDFGraphicState::GetInvertFunction() { | 115 SkPDFObject* SkPDFGraphicState::GetInvertFunction() { |
116 // This assumes that canonicalPaintsMutex is held. | 116 // This assumes that canonicalPaintsMutex is held. |
| 117 CanonicalPaintsMutex().assertHeld(); |
117 static SkPDFStream* invertFunction = NULL; | 118 static SkPDFStream* invertFunction = NULL; |
118 if (!invertFunction) { | 119 if (!invertFunction) { |
119 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use | 120 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use |
120 // a type 2 function, so we use a type 4 function. | 121 // a type 2 function, so we use a type 4 function. |
121 SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray); | 122 SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray); |
122 domainAndRange->reserve(2); | 123 domainAndRange->reserve(2); |
123 domainAndRange->appendInt(0); | 124 domainAndRange->appendInt(0); |
124 domainAndRange->appendInt(1); | 125 domainAndRange->appendInt(1); |
125 | 126 |
126 static const char psInvert[] = "{1 exch sub}"; | 127 static const char psInvert[] = "{1 exch sub}"; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } | 280 } |
280 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode || | 281 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode || |
281 blend_mode_from_xfermode(bXfermodeName) == NULL) { | 282 blend_mode_from_xfermode(bXfermodeName) == NULL) { |
282 bXfermodeName = SkXfermode::kSrcOver_Mode; | 283 bXfermodeName = SkXfermode::kSrcOver_Mode; |
283 } | 284 } |
284 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName); | 285 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName); |
285 SkASSERT(bXfermodeString != NULL); | 286 SkASSERT(bXfermodeString != NULL); |
286 | 287 |
287 return strcmp(aXfermodeString, bXfermodeString) == 0; | 288 return strcmp(aXfermodeString, bXfermodeString) == 0; |
288 } | 289 } |
OLD | NEW |