| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkPDFCatalog.h" | 10 #include "SkPDFCatalog.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // static | 136 // static |
| 137 void SkPDFScalar::Append(SkScalar value, SkWStream* stream) { | 137 void SkPDFScalar::Append(SkScalar value, SkWStream* stream) { |
| 138 // The range of reals in PDF/A is the same as SkFixed: +/- 32,767 and | 138 // The range of reals in PDF/A is the same as SkFixed: +/- 32,767 and |
| 139 // +/- 1/65,536 (though integers can range from 2^31 - 1 to -2^31). | 139 // +/- 1/65,536 (though integers can range from 2^31 - 1 to -2^31). |
| 140 // When using floats that are outside the whole value range, we can use | 140 // When using floats that are outside the whole value range, we can use |
| 141 // integers instead. | 141 // integers instead. |
| 142 | 142 |
| 143 #if !defined(SK_ALLOW_LARGE_PDF_SCALARS) | 143 #if !defined(SK_ALLOW_LARGE_PDF_SCALARS) |
| 144 if (value > 32767 || value < -32767) { | 144 if (value > 32767 || value < -32767) { |
| 145 stream->writeDecAsText(SkScalarRound(value)); | 145 stream->writeDecAsText(SkScalarRoundToInt(value)); |
| 146 return; | 146 return; |
| 147 } | 147 } |
| 148 | 148 |
| 149 char buffer[SkStrAppendScalar_MaxSize]; | 149 char buffer[SkStrAppendScalar_MaxSize]; |
| 150 char* end = SkStrAppendFixed(buffer, SkScalarToFixed(value)); | 150 char* end = SkStrAppendFixed(buffer, SkScalarToFixed(value)); |
| 151 stream->write(buffer, end - buffer); | 151 stream->write(buffer, end - buffer); |
| 152 return; | 152 return; |
| 153 #endif // !SK_ALLOW_LARGE_PDF_SCALARS | 153 #endif // !SK_ALLOW_LARGE_PDF_SCALARS |
| 154 | 154 |
| 155 #if defined(SK_ALLOW_LARGE_PDF_SCALARS) | 155 #if defined(SK_ALLOW_LARGE_PDF_SCALARS) |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 SkPDFName* SkPDFDict::Iter::next(SkPDFObject** value) { | 476 SkPDFName* SkPDFDict::Iter::next(SkPDFObject** value) { |
| 477 if (fIter != fStop) { | 477 if (fIter != fStop) { |
| 478 const Rec* cur = fIter; | 478 const Rec* cur = fIter; |
| 479 fIter++; | 479 fIter++; |
| 480 *value = cur->value; | 480 *value = cur->value; |
| 481 return cur->key; | 481 return cur->key; |
| 482 } | 482 } |
| 483 *value = NULL; | 483 *value = NULL; |
| 484 return NULL; | 484 return NULL; |
| 485 } | 485 } |
| OLD | NEW |