| 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 "SkData.h" | 8 #include "SkData.h" |
| 9 #include "SkPDFFormXObject.h" | 9 #include "SkPDFFormXObject.h" |
| 10 #include "SkPDFGraphicState.h" | 10 #include "SkPDFGraphicState.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use | 116 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use |
| 117 // a type 2 function, so we use a type 4 function. | 117 // a type 2 function, so we use a type 4 function. |
| 118 SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray); | 118 SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray); |
| 119 domainAndRange->reserve(2); | 119 domainAndRange->reserve(2); |
| 120 domainAndRange->appendInt(0); | 120 domainAndRange->appendInt(0); |
| 121 domainAndRange->appendInt(1); | 121 domainAndRange->appendInt(1); |
| 122 | 122 |
| 123 static const char psInvert[] = "{1 exch sub}"; | 123 static const char psInvert[] = "{1 exch sub}"; |
| 124 // Do not copy the trailing '\0' into the SkData. | 124 // Do not copy the trailing '\0' into the SkData. |
| 125 SkAutoTUnref<SkData> psInvertStream( | 125 SkAutoTUnref<SkData> psInvertStream( |
| 126 SkData::NewWithCopy(psInvert, strlen(psInvert))); | 126 SkData::NewWithoutCopy(psInvert, strlen(psInvert))); |
| 127 | 127 |
| 128 invertFunction = new SkPDFStream(psInvertStream.get()); | 128 invertFunction = new SkPDFStream(psInvertStream.get()); |
| 129 invertFunction->insertInt("FunctionType", 4); | 129 invertFunction->insertInt("FunctionType", 4); |
| 130 invertFunction->insert("Domain", domainAndRange.get()); | 130 invertFunction->insert("Domain", domainAndRange.get()); |
| 131 invertFunction->insert("Range", domainAndRange.get()); | 131 invertFunction->insert("Range", domainAndRange.get()); |
| 132 } | 132 } |
| 133 return invertFunction; | 133 return invertFunction; |
| 134 } | 134 } |
| 135 | 135 |
| 136 // static | 136 // static |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode || | 279 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode || |
| 280 blend_mode_from_xfermode(bXfermodeName) == NULL) { | 280 blend_mode_from_xfermode(bXfermodeName) == NULL) { |
| 281 bXfermodeName = SkXfermode::kSrcOver_Mode; | 281 bXfermodeName = SkXfermode::kSrcOver_Mode; |
| 282 } | 282 } |
| 283 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName); | 283 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName); |
| 284 SkASSERT(bXfermodeString != NULL); | 284 SkASSERT(bXfermodeString != NULL); |
| 285 | 285 |
| 286 return strcmp(aXfermodeString, bXfermodeString) == 0; | 286 return strcmp(aXfermodeString, bXfermodeString) == 0; |
| 287 } | 287 } |
| OLD | NEW |