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 "SkPdfNativeDoc.h" | 8 #include "SkPdfNativeDoc.h" |
9 | 9 |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 if (!token.isKeyword("obj")) { | 182 if (!token.isKeyword("obj")) { |
183 SkPdfReport(kWarning_SkPdfIssueSeverity, kMissingToken_SkPdfIssu
e, | 183 SkPdfReport(kWarning_SkPdfIssueSeverity, kMissingToken_SkPdfIssu
e, |
184 "Could not find obj", NULL, NULL); | 184 "Could not find obj", NULL, NULL); |
185 continue; | 185 continue; |
186 } | 186 } |
187 | 187 |
188 while (fObjects.count() < id + 1) { | 188 while (fObjects.count() < id + 1) { |
189 reset(fObjects.append()); | 189 reset(fObjects.append()); |
190 } | 190 } |
191 | 191 |
192 fObjects[id].fOffset = current - fFileContent; | 192 fObjects[id].fOffset = SkToInt(current - fFileContent); |
193 | 193 |
194 SkPdfNativeObject* obj = fAllocator->allocObject(); | 194 SkPdfNativeObject* obj = fAllocator->allocObject(); |
195 current = nextObject(current, end, obj, fAllocator, this); | 195 current = nextObject(current, end, obj, fAllocator, this); |
196 | 196 |
197 fObjects[id].fResolvedReference = obj; | 197 fObjects[id].fResolvedReference = obj; |
198 fObjects[id].fObj = obj; | 198 fObjects[id].fObj = obj; |
199 fObjects[id].fIsReferenceResolved = true; | 199 fObjects[id].fIsReferenceResolved = true; |
200 } else if (token.isKeyword("trailer")) { | 200 } else if (token.isKeyword("trailer")) { |
201 long dummy; | 201 long dummy; |
202 current = readTrailer(current, end, true, &dummy, true); | 202 current = readTrailer(current, end, true, &dummy, true); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 return (SkPdfNativeObject*)ref; | 573 return (SkPdfNativeObject*)ref; |
574 } | 574 } |
575 | 575 |
576 size_t SkPdfNativeDoc::bytesUsed() const { | 576 size_t SkPdfNativeDoc::bytesUsed() const { |
577 return fAllocator->bytesUsed() + | 577 return fAllocator->bytesUsed() + |
578 fContentLength + | 578 fContentLength + |
579 fObjects.count() * sizeof(PublicObjectEntry) + | 579 fObjects.count() * sizeof(PublicObjectEntry) + |
580 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + | 580 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + |
581 sizeof(*this); | 581 sizeof(*this); |
582 } | 582 } |
OLD | NEW |