OLD | NEW |
1 | 1 |
2 #include "SkPdfNativeTokenizer.h" | 2 #include "SkPdfNativeTokenizer.h" |
3 #include "SkPdfObject.h" | 3 #include "SkPdfObject.h" |
4 #include "SkPdfConfig.h" | 4 #include "SkPdfConfig.h" |
5 | 5 |
6 #include "SkPdfStreamCommonDictionary_autogen.h" | 6 #include "SkPdfStreamCommonDictionary_autogen.h" |
7 #include "SkPdfImageDictionary_autogen.h" | 7 #include "SkPdfImageDictionary_autogen.h" |
8 | 8 |
9 // TODO(edisonn): perf!!! | 9 // TODO(edisonn): perf!!! |
10 // there could be 0s between start and end! but not in the needle. | 10 // there could be 0s between start and end! but not in the needle. |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 if (fUncompressedStream >= fUncompressedStreamEnd) { | 920 if (fUncompressedStream >= fUncompressedStreamEnd) { |
921 return false; | 921 return false; |
922 } | 922 } |
923 | 923 |
924 SkPdfObject obj; | 924 SkPdfObject obj; |
925 fUncompressedStream = nextObject(0, fUncompressedStream, fUncompressedStream
End, &obj, fAllocator, fDoc); | 925 fUncompressedStream = nextObject(0, fUncompressedStream, fUncompressedStream
End, &obj, fAllocator, fDoc); |
926 | 926 |
927 // If it is a keyword, we will only get the pointer of the string | 927 // If it is a keyword, we will only get the pointer of the string |
928 if (obj.type() == SkPdfObject::kKeyword_PdfObjectType) { | 928 if (obj.type() == SkPdfObject::kKeyword_PdfObjectType) { |
929 token->fKeyword = obj.c_str(); | 929 token->fKeyword = obj.c_str(); |
930 token->fKeywordLength = obj.len(); | 930 token->fKeywordLength = obj.lenstr(); |
931 token->fType = kKeyword_TokenType; | 931 token->fType = kKeyword_TokenType; |
932 } else { | 932 } else { |
933 SkPdfObject* pobj = fAllocator->allocObject(); | 933 SkPdfObject* pobj = fAllocator->allocObject(); |
934 *pobj = obj; | 934 *pobj = obj; |
935 token->fObject = pobj; | 935 token->fObject = pobj; |
936 token->fType = kObject_TokenType; | 936 token->fType = kObject_TokenType; |
937 } | 937 } |
938 | 938 |
939 #ifdef PDF_TRACE_READ_TOKEN | 939 #ifdef PDF_TRACE_READ_TOKEN |
940 static int read_op = 0; | 940 static int read_op = 0; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 return NULL; | 1055 return NULL; |
1056 } | 1056 } |
1057 | 1057 |
1058 SkPdfImageDictionary* inlineImage = (SkPdfImageDictionary*)fAllocator->alloc
Object(); | 1058 SkPdfImageDictionary* inlineImage = (SkPdfImageDictionary*)fAllocator->alloc
Object(); |
1059 SkPdfObject::makeEmptyDictionary(inlineImage); | 1059 SkPdfObject::makeEmptyDictionary(inlineImage); |
1060 | 1060 |
1061 while (fUncompressedStream < fUncompressedStreamEnd) { | 1061 while (fUncompressedStream < fUncompressedStreamEnd) { |
1062 SkPdfObject* key = fAllocator->allocObject(); | 1062 SkPdfObject* key = fAllocator->allocObject(); |
1063 fUncompressedStream = nextObject(0, fUncompressedStream, fUncompressedSt
reamEnd, key, fAllocator, fDoc); | 1063 fUncompressedStream = nextObject(0, fUncompressedStream, fUncompressedSt
reamEnd, key, fAllocator, fDoc); |
1064 | 1064 |
1065 if (key->isKeyword() && key->len() == 2 && key->c_str()[0] == 'I' && key
->c_str()[1] == 'D') { // ID | 1065 if (key->isKeyword() && key->lenstr() == 2 && key->c_str()[0] == 'I' &&
key->c_str()[1] == 'D') { // ID |
1066 fUncompressedStream = readInlineImageStream(0, fUncompressedStream,
fUncompressedStreamEnd, inlineImage, fDoc); | 1066 fUncompressedStream = readInlineImageStream(0, fUncompressedStream,
fUncompressedStreamEnd, inlineImage, fDoc); |
1067 return inlineImage; | 1067 return inlineImage; |
1068 } else { | 1068 } else { |
1069 SkPdfObject* obj = fAllocator->allocObject(); | 1069 SkPdfObject* obj = fAllocator->allocObject(); |
1070 fUncompressedStream = nextObject(0, fUncompressedStream, fUncompress
edStreamEnd, obj, fAllocator, fDoc); | 1070 fUncompressedStream = nextObject(0, fUncompressedStream, fUncompress
edStreamEnd, obj, fAllocator, fDoc); |
1071 // TODO(edisonn): perf maybe we should not expand abreviation like t
his | 1071 // TODO(edisonn): perf maybe we should not expand abreviation like t
his |
1072 inlineImage->set(inlineImageKeyAbbreviationExpand(key), | 1072 inlineImage->set(inlineImageKeyAbbreviationExpand(key), |
1073 inlineImageValueAbbreviationExpand(obj)); | 1073 inlineImageValueAbbreviationExpand(obj)); |
1074 } | 1074 } |
1075 } | 1075 } |
1076 // TODO(edisonn): report end of data with inline image without an EI | 1076 // TODO(edisonn): report end of data with inline image without an EI |
1077 return inlineImage; | 1077 return inlineImage; |
1078 } | 1078 } |
OLD | NEW |