| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 stream->writeDecAsText(first + 1); | 121 stream->writeDecAsText(first + 1); |
| 122 stream->writeText(" "); | 122 stream->writeText(" "); |
| 123 stream->writeDecAsText(last - first + 1); | 123 stream->writeDecAsText(last - first + 1); |
| 124 stream->writeText("\n"); | 124 stream->writeText("\n"); |
| 125 | 125 |
| 126 if (first == -1) { | 126 if (first == -1) { |
| 127 stream->writeText("0000000000 65535 f \n"); | 127 stream->writeText("0000000000 65535 f \n"); |
| 128 first++; | 128 first++; |
| 129 } | 129 } |
| 130 for (int i = first; i <= last; i++) { | 130 for (int i = first; i <= last; i++) { |
| 131 // For 32 bits platforms, the maximum offset has to fit within off_t whi
ch is a 32 bits |
| 132 // signed integer on these platforms. On other platforms, we can use the
actual maximum. |
| 133 SkDEBUGCODE(static const off_t kMaxOff = (sizeof(off_t) > 4) ? 100000000
00 : 2147483647;) |
| 131 SkASSERT(fCatalog[i].fFileOffset > 0); | 134 SkASSERT(fCatalog[i].fFileOffset > 0); |
| 132 SkASSERT(fCatalog[i].fFileOffset <= 9999999999LL); | 135 SkASSERT(fCatalog[i].fFileOffset < kMaxOff); |
| 133 stream->writeBigDecAsText(fCatalog[i].fFileOffset, 10); | 136 stream->writeBigDecAsText(fCatalog[i].fFileOffset, 10); |
| 134 stream->writeText(" 00000 n \n"); | 137 stream->writeText(" 00000 n \n"); |
| 135 } | 138 } |
| 136 | 139 |
| 137 return fCatalog.count() + 1; | 140 return fCatalog.count() + 1; |
| 138 } | 141 } |
| 139 | 142 |
| 140 void SkPDFCatalog::setSubstitute(SkPDFObject* original, | 143 void SkPDFCatalog::setSubstitute(SkPDFObject* original, |
| 141 SkPDFObject* substitute) { | 144 SkPDFObject* substitute) { |
| 142 #if defined(SK_DEBUG) | 145 #if defined(SK_DEBUG) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 SkTDArray<SkPDFObject*>* targetList = getSubstituteList(firstPage); | 202 SkTDArray<SkPDFObject*>* targetList = getSubstituteList(firstPage); |
| 200 for (int i = 0; i < targetList->count(); ++i) { | 203 for (int i = 0; i < targetList->count(); ++i) { |
| 201 (*targetList)[i]->emit(stream, this, true); | 204 (*targetList)[i]->emit(stream, this, true); |
| 202 } | 205 } |
| 203 } | 206 } |
| 204 | 207 |
| 205 SkTDArray<SkPDFObject*>* SkPDFCatalog::getSubstituteList(bool firstPage) { | 208 SkTDArray<SkPDFObject*>* SkPDFCatalog::getSubstituteList(bool firstPage) { |
| 206 return firstPage ? &fSubstituteResourcesFirstPage : | 209 return firstPage ? &fSubstituteResourcesFirstPage : |
| 207 &fSubstituteResourcesRemaining; | 210 &fSubstituteResourcesRemaining; |
| 208 } | 211 } |
| OLD | NEW |