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 "SkPdfNativeTokenizer.h" | 8 #include "SkPdfNativeTokenizer.h" |
9 #include "SkPdfNativeObject.h" | 9 #include "SkPdfNativeObject.h" |
10 #include "SkPdfConfig.h" | 10 #include "SkPdfConfig.h" |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 token->fType = kObject_TokenType; | 964 token->fType = kObject_TokenType; |
965 } | 965 } |
966 | 966 |
967 #ifdef PDF_TRACE_READ_TOKEN | 967 #ifdef PDF_TRACE_READ_TOKEN |
968 read_op++; | 968 read_op++; |
969 #if 0 | 969 #if 0 |
970 if (548 == read_op) { | 970 if (548 == read_op) { |
971 printf("break;\n"); | 971 printf("break;\n"); |
972 } | 972 } |
973 #endif | 973 #endif |
974 printf("%i READ %s %s\n", read_op, token->fType == kKeyword_TokenType ? "Key
word" : "Object", token->fKeyword ? std::string(token->fKeyword, token->fKeyword
Length).c_str() : token->fObject->toString().c_str()); | 974 printf("%i READ %s %s\n", read_op, token->fType == kKeyword_TokenType ? "Key
word" : "Object", token->fKeyword ? SkString(token->fKeyword, token->fKeywordLen
gth).c_str() : token->fObject->toString().c_str()); |
975 #endif | 975 #endif |
976 | 976 |
977 return true; | 977 return true; |
978 } | 978 } |
979 | 979 |
980 void SkPdfNativeTokenizer::PutBack(PdfToken token) { | 980 void SkPdfNativeTokenizer::PutBack(PdfToken token) { |
981 SkASSERT(!fHasPutBack); | 981 SkASSERT(!fHasPutBack); |
982 fHasPutBack = true; | 982 fHasPutBack = true; |
983 fPutBack = token; | 983 fPutBack = token; |
984 #ifdef PDF_TRACE_READ_TOKEN | 984 #ifdef PDF_TRACE_READ_TOKEN |
985 printf("PUT_BACK %s %s\n", token.fType == kKeyword_TokenType ? "Keyword" : "
Object", token.fKeyword ? std::string(token.fKeyword, token.fKeywordLength).c_st
r(): token.fObject->toString().c_str()); | 985 printf("PUT_BACK %s %s\n", token.fType == kKeyword_TokenType ? "Keyword" : "
Object", token.fKeyword ? SkString(token.fKeyword, token.fKeywordLength).c_str()
: token.fObject->toString().c_str()); |
986 #endif | 986 #endif |
987 } | 987 } |
988 | 988 |
989 bool SkPdfNativeTokenizer::readToken(PdfToken* token) { | 989 bool SkPdfNativeTokenizer::readToken(PdfToken* token) { |
990 if (fHasPutBack) { | 990 if (fHasPutBack) { |
991 *token = fPutBack; | 991 *token = fPutBack; |
992 fHasPutBack = false; | 992 fHasPutBack = false; |
993 #ifdef PDF_TRACE_READ_TOKEN | 993 #ifdef PDF_TRACE_READ_TOKEN |
994 printf("READ_BACK %s %s\n", token->fType == kKeyword_TokenType ? "Keyword" :
"Object", token->fKeyword ? std::string(token->fKeyword, token->fKeywordLength)
.c_str() : token->fObject->toString().c_str()); | 994 printf("READ_BACK %s %s\n", token->fType == kKeyword_TokenType ? "Keyword" :
"Object", token->fKeyword ? SkString(token->fKeyword, token->fKeywordLength).c_
str() : token->fObject->toString().c_str()); |
995 #endif | 995 #endif |
996 return true; | 996 return true; |
997 } | 997 } |
998 | 998 |
999 if (fEmpty) { | 999 if (fEmpty) { |
1000 #ifdef PDF_TRACE_READ_TOKEN | 1000 #ifdef PDF_TRACE_READ_TOKEN |
1001 printf("EMPTY TOKENIZER\n"); | 1001 printf("EMPTY TOKENIZER\n"); |
1002 #endif | 1002 #endif |
1003 return false; | 1003 return false; |
1004 } | 1004 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 SkPdfNativeObject* obj = fAllocator->allocObject(); | 1098 SkPdfNativeObject* obj = fAllocator->allocObject(); |
1099 fUncompressedStream = nextObject(0, fUncompressedStream, fUncompress
edStreamEnd, obj, fAllocator, fDoc); | 1099 fUncompressedStream = nextObject(0, fUncompressedStream, fUncompress
edStreamEnd, obj, fAllocator, fDoc); |
1100 // TODO(edisonn): perf maybe we should not expand abreviation like t
his | 1100 // TODO(edisonn): perf maybe we should not expand abreviation like t
his |
1101 inlineImage->set(inlineImageKeyAbbreviationExpand(key), | 1101 inlineImage->set(inlineImageKeyAbbreviationExpand(key), |
1102 inlineImageValueAbbreviationExpand(obj)); | 1102 inlineImageValueAbbreviationExpand(obj)); |
1103 } | 1103 } |
1104 } | 1104 } |
1105 // TODO(edisonn): report end of data with inline image without an EI | 1105 // TODO(edisonn): report end of data with inline image without an EI |
1106 return inlineImage; | 1106 return inlineImage; |
1107 } | 1107 } |
OLD | NEW |