Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: experimental/PdfViewer/pdf_viewer_main.cpp

Issue 17095004: Object model generated from pdf spec 1.4, draft code (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/generate_code.py ('k') | experimental/PdfViewer/pdfspec_autogen.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkGraphics.h" 10 #include "SkGraphics.h"
(...skipping 12 matching lines...) Expand all
23 23
24 #include "podofo.h" 24 #include "podofo.h"
25 using namespace PoDoFo; 25 using namespace PoDoFo;
26 26
27 bool LongFromDictionary(const PdfMemDocument* pdfDoc, 27 bool LongFromDictionary(const PdfMemDocument* pdfDoc,
28 const PdfDictionary& dict, 28 const PdfDictionary& dict,
29 const char* key, 29 const char* key,
30 const char* abr, 30 const char* abr,
31 long* data); 31 long* data);
32 32
33 bool DoubleFromDictionary(const PdfMemDocument* pdfDoc,
34 const PdfDictionary& dict,
35 const char* key,
36 const char* abr,
37 double* data);
38
33 bool BoolFromDictionary(const PdfMemDocument* pdfDoc, 39 bool BoolFromDictionary(const PdfMemDocument* pdfDoc,
34 const PdfDictionary& dict, 40 const PdfDictionary& dict,
35 const char* key, 41 const char* key,
36 const char* abr, 42 const char* abr,
37 bool* data); 43 bool* data);
38 44
39 bool NameFromDictionary(const PdfMemDocument* pdfDoc, 45 bool NameFromDictionary(const PdfMemDocument* pdfDoc,
40 const PdfDictionary& dict, 46 const PdfDictionary& dict,
41 const char* key, 47 const char* key,
42 const char* abr, 48 const char* abr,
43 std::string* data); 49 std::string* data);
44 50
51 bool StringFromDictionary(const PdfMemDocument* pdfDoc,
52 const PdfDictionary& dict,
53 const char* key,
54 const char* abr,
55 std::string* data);
56
57 class SkPdfDictionary;
58 bool DictionaryFromDictionary(const PdfMemDocument* pdfDoc,
59 const PdfDictionary& dict,
60 const char* key,
61 const char* abr,
62 SkPdfDictionary** data);
63
64 class SkPdfObject;
65 bool ObjectFromDictionary(const PdfMemDocument* pdfDoc,
66 const PdfDictionary& dict,
67 const char* key,
68 const char* abr,
69 SkPdfObject** data);
45 70
46 71
47 #include "pdf_auto_gen.h" 72 #include "pdf_auto_gen.h"
48 73
49 /* 74 /*
50 * TODO(edisonn): ASAP so skp -> pdf -> png looks greap 75 * TODO(edisonn): ASAP so skp -> pdf -> png looks greap
51 * - load gs/ especially smask and already known prop 76 * - load gs/ especially smask and already known prop
52 * - use transparency (I think ca and CA ops) 77 * - use transparency (I think ca and CA ops)
53 * - load font for baidu.pdf 78 * - load font for baidu.pdf
54 * - load font for youtube.pdf 79 * - load font for youtube.pdf
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 bool LongFromDictionary(const PdfMemDocument* pdfDoc, 794 bool LongFromDictionary(const PdfMemDocument* pdfDoc,
770 const PdfDictionary& dict, 795 const PdfDictionary& dict,
771 const char* key, 796 const char* key,
772 const char* abr, 797 const char* abr,
773 long* data) { 798 long* data) {
774 if (LongFromDictionary(pdfDoc, dict, key, data)) return true; 799 if (LongFromDictionary(pdfDoc, dict, key, data)) return true;
775 if (abr == NULL || *abr == '\0') return false; 800 if (abr == NULL || *abr == '\0') return false;
776 return LongFromDictionary(pdfDoc, dict, abr, data); 801 return LongFromDictionary(pdfDoc, dict, abr, data);
777 } 802 }
778 803
804 bool DoubleFromDictionary(const PdfMemDocument* pdfDoc,
805 const PdfDictionary& dict,
806 const char* key,
807 double* data) {
808 const PdfObject* value = resolveReferenceObject(pdfDoc,
809 dict.GetKey(PdfName(key)));
810
811 if (value == NULL || !value->IsReal()) {
812 return false;
813 }
814
815 *data = value->GetReal();
816 return true;
817 }
818
819 bool DoubleFromDictionary(const PdfMemDocument* pdfDoc,
820 const PdfDictionary& dict,
821 const char* key,
822 const char* abr,
823 double* data) {
824 if (DoubleFromDictionary(pdfDoc, dict, key, data)) return true;
825 if (abr == NULL || *abr == '\0') return false;
826 return DoubleFromDictionary(pdfDoc, dict, abr, data);
827 }
828
829
779 bool BoolFromDictionary(const PdfMemDocument* pdfDoc, 830 bool BoolFromDictionary(const PdfMemDocument* pdfDoc,
780 const PdfDictionary& dict, 831 const PdfDictionary& dict,
781 const char* key, 832 const char* key,
782 bool* data) { 833 bool* data) {
783 const PdfObject* value = resolveReferenceObject(pdfDoc, 834 const PdfObject* value = resolveReferenceObject(pdfDoc,
784 dict.GetKey(PdfName(key))); 835 dict.GetKey(PdfName(key)));
785 836
786 if (value == NULL || !value->IsBool()) { 837 if (value == NULL || !value->IsBool()) {
787 return false; 838 return false;
788 } 839 }
(...skipping 30 matching lines...) Expand all
819 bool NameFromDictionary(const PdfMemDocument* pdfDoc, 870 bool NameFromDictionary(const PdfMemDocument* pdfDoc,
820 const PdfDictionary& dict, 871 const PdfDictionary& dict,
821 const char* key, 872 const char* key,
822 const char* abr, 873 const char* abr,
823 std::string* data) { 874 std::string* data) {
824 if (NameFromDictionary(pdfDoc, dict, key, data)) return true; 875 if (NameFromDictionary(pdfDoc, dict, key, data)) return true;
825 if (abr == NULL || *abr == '\0') return false; 876 if (abr == NULL || *abr == '\0') return false;
826 return NameFromDictionary(pdfDoc, dict, abr, data); 877 return NameFromDictionary(pdfDoc, dict, abr, data);
827 } 878 }
828 879
880 bool StringFromDictionary(const PdfMemDocument* pdfDoc,
881 const PdfDictionary& dict,
882 const char* key,
883 std::string* data) {
884 const PdfObject* value = resolveReferenceObject(pdfDoc,
885 dict.GetKey(PdfName(key)),
886 true);
887 if (value == NULL || (!value->IsString() && !value->IsHexString())) {
888 return false;
889 }
890
891 *data = value->GetString().GetString();
892 return true;
893 }
894
895 bool StringFromDictionary(const PdfMemDocument* pdfDoc,
896 const PdfDictionary& dict,
897 const char* key,
898 const char* abr,
899 std::string* data) {
900 if (StringFromDictionary(pdfDoc, dict, key, data)) return true;
901 if (abr == NULL || *abr == '\0') return false;
902 return StringFromDictionary(pdfDoc, dict, abr, data);
903 }
904
905 bool DictionaryFromDictionary(const PdfMemDocument* pdfDoc,
906 const PdfDictionary& dict,
907 const char* key,
908 SkPdfDictionary** data) {
909 const PdfObject* value = resolveReferenceObject(pdfDoc,
910 dict.GetKey(PdfName(key)),
911 true);
912 if (value == NULL || !value->IsDictionary()) {
913 return false;
914 }
915
916 return PodofoMapper::mapDictionary(*pdfDoc, *value, (SkPdfObject**)data);
917 }
918
919 bool DictionaryFromDictionary(const PdfMemDocument* pdfDoc,
920 const PdfDictionary& dict,
921 const char* key,
922 const char* abr,
923 SkPdfDictionary** data) {
924 if (DictionaryFromDictionary(pdfDoc, dict, key, data)) return true;
925 if (abr == NULL || *abr == '\0') return false;
926 return DictionaryFromDictionary(pdfDoc, dict, abr, data);
927 }
928
929 bool ObjectFromDictionary(const PdfMemDocument* pdfDoc,
930 const PdfDictionary& dict,
931 const char* key,
932 SkPdfObject** data) {
933 const PdfObject* value = resolveReferenceObject(pdfDoc,
934 dict.GetKey(PdfName(key)),
935 true);
936 if (value == NULL) {
937 return false;
938 }
939 return PodofoMapper::mapObject(*pdfDoc, *value, data);
940 }
941
942 bool ObjectFromDictionary(const PdfMemDocument* pdfDoc,
943 const PdfDictionary& dict,
944 const char* key,
945 const char* abr,
946 SkPdfObject** data) {
947 if (ObjectFromDictionary(pdfDoc, dict, key, data)) return true;
948 if (abr == NULL || *abr == '\0') return false;
949 return ObjectFromDictionary(pdfDoc, dict, abr, data);
950 }
951
952
829 // TODO(edisonn): perf!!! 953 // TODO(edisonn): perf!!!
830 954
831 static SkColorTable* getGrayColortable() { 955 static SkColorTable* getGrayColortable() {
832 static SkColorTable* grayColortable = NULL; 956 static SkColorTable* grayColortable = NULL;
833 if (grayColortable == NULL) { 957 if (grayColortable == NULL) {
834 SkPMColor* colors = new SkPMColor[256]; 958 SkPMColor* colors = new SkPMColor[256];
835 for (int i = 0 ; i < 256; i++) { 959 for (int i = 0 ; i < 256; i++) {
836 colors[i] = SkPreMultiplyARGB(255, i, i, i); 960 colors[i] = SkPreMultiplyARGB(255, i, i, i);
837 } 961 }
838 grayColortable = new SkColorTable(colors, 256); 962 grayColortable = new SkColorTable(colors, 256);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 1069
946 // utils 1070 // utils
947 1071
948 // TODO(edisonn): add cache, or put the bitmap property directly on the PdfObjec t 1072 // TODO(edisonn): add cache, or put the bitmap property directly on the PdfObjec t
949 // TODO(edisonn): deal with colorSpaces, we could add them to SkBitmap::Config 1073 // TODO(edisonn): deal with colorSpaces, we could add them to SkBitmap::Config
950 // TODO(edisonn): preserve A1 format that skia knows, + fast convert from 111, 2 22, 444 to closest 1074 // TODO(edisonn): preserve A1 format that skia knows, + fast convert from 111, 2 22, 444 to closest
951 // skia format, through a table 1075 // skia format, through a table
952 1076
953 // this functions returns the image, it does not look at the smask. 1077 // this functions returns the image, it does not look at the smask.
954 1078
955 SkBitmap getImageFromObject(PdfContext* pdfContext, const SkPdfImage* image, boo l transparencyMask) { 1079 SkBitmap getImageFromObject(PdfContext* pdfContext, const SkPdfImageDictionary* image, bool transparencyMask) {
956 if (image == NULL || !image->valid()) { 1080 if (image == NULL || !image->valid()) {
957 // TODO(edisonn): report warning to be used in testing. 1081 // TODO(edisonn): report warning to be used in testing.
958 return SkBitmap(); 1082 return SkBitmap();
959 } 1083 }
960 1084
961 // TODO (edisonn): Fast Jpeg(DCTDecode) draw, or fast PNG(FlateDecode) draw ... 1085 // TODO (edisonn): Fast Jpeg(DCTDecode) draw, or fast PNG(FlateDecode) draw ...
962 // PdfObject* value = resolveReferenceObject(pdfContext->fPdfDoc, 1086 // PdfObject* value = resolveReferenceObject(pdfContext->fPdfDoc,
963 // obj.GetDictionary().GetKey(PdfNa me("Filter"))); 1087 // obj.GetDictionary().GetKey(PdfNa me("Filter")));
964 // if (value && value->IsArray() && value->GetArray().GetSize() == 1) { 1088 // if (value && value->IsArray() && value->GetArray().GetSize() == 1) {
965 // value = resolveReferenceObject(pdfContext->fPdfDoc, 1089 // value = resolveReferenceObject(pdfContext->fPdfDoc,
966 // &value->GetArray()[0]); 1090 // &value->GetArray()[0]);
967 // } 1091 // }
968 // if (value && value->IsName() && value->GetName().GetName() == "DCTDecode") { 1092 // if (value && value->IsName() && value->GetName().GetName() == "DCTDecode") {
969 // SkStream stream = SkStream:: 1093 // SkStream stream = SkStream::
970 // SkImageDecoder::Factory() 1094 // SkImageDecoder::Factory()
971 // } 1095 // }
972 1096
973 long bpc = image->bpc(); 1097 long bpc = image->BitsPerComponent();
974 long width = image->w(); 1098 long width = image->Width();
975 long height = image->h(); 1099 long height = image->Height();
976 std::string colorSpace = image->cs(); 1100 SkPdfObject* colorSpaceDict = image->ColorSpace();
1101 std::string colorSpace = "DeviceRGB";
1102 // TODO(edisonn): for multiple type fileds, generate code, like, isName(), i sArray(), ...and fields like colorSpace_name(), colorSpace_array()
1103 // so we do nto go to podofo anywhere in our cpp file
1104 if (colorSpaceDict && colorSpaceDict->podofo() && colorSpaceDict->podofo()-> IsName()) {
1105 colorSpace = colorSpaceDict->podofo()->GetName().GetName();
1106 }
977 1107
978 /* 1108 /*
979 bool imageMask = image->imageMask(); 1109 bool imageMask = image->imageMask();
980 1110
981 if (imageMask) { 1111 if (imageMask) {
982 if (bpc != 0 && bpc != 1) { 1112 if (bpc != 0 && bpc != 1) {
983 // TODO(edisonn): report warning to be used in testing. 1113 // TODO(edisonn): report warning to be used in testing.
984 return SkBitmap(); 1114 return SkBitmap();
985 } 1115 }
986 bpc = 1; 1116 bpc = 1;
(...skipping 25 matching lines...) Expand all
1012 (unsigned char*)uncompressedStream, uncompressedStreamLength, 1142 (unsigned char*)uncompressedStream, uncompressedStreamLength,
1013 width, height, bytesPerLine, 1143 width, height, bytesPerLine,
1014 bpc, colorSpace, 1144 bpc, colorSpace,
1015 transparencyMask); 1145 transparencyMask);
1016 1146
1017 free(uncompressedStream); 1147 free(uncompressedStream);
1018 1148
1019 return bitmap; 1149 return bitmap;
1020 } 1150 }
1021 1151
1022 SkBitmap getSmaskFromObject(PdfContext* pdfContext, const SkPdfImage* obj) { 1152 SkBitmap getSmaskFromObject(PdfContext* pdfContext, const SkPdfImageDictionary* obj) {
1023 const PdfObject* sMask = resolveReferenceObject(pdfContext->fPdfDoc, 1153 const PdfObject* sMask = resolveReferenceObject(pdfContext->fPdfDoc,
1024 obj->podofo()->GetDictionary().Get Key(PdfName("SMask"))); 1154 obj->podofo()->GetDictionary().Get Key(PdfName("SMask")));
1025 1155
1026 #ifdef PDF_TRACE 1156 #ifdef PDF_TRACE
1027 std::string str; 1157 std::string str;
1028 if (sMask) { 1158 if (sMask) {
1029 sMask->ToString(str); 1159 sMask->ToString(str);
1030 printf("/SMask of /Subtype /Image: %s\n", str.c_str()); 1160 printf("/SMask of /Subtype /Image: %s\n", str.c_str());
1031 } 1161 }
1032 #endif 1162 #endif
1033 1163
1034 if (sMask) { 1164 if (sMask) {
1035 SkPdfImage skxobjmask(pdfContext->fPdfDoc, sMask); 1165 SkPdfImageDictionary skxobjmask(pdfContext->fPdfDoc, sMask);
1036 return getImageFromObject(pdfContext, &skxobjmask, true); 1166 return getImageFromObject(pdfContext, &skxobjmask, true);
1037 } 1167 }
1038 1168
1039 // TODO(edisonn): implement GS SMask. Default to empty right now. 1169 // TODO(edisonn): implement GS SMask. Default to empty right now.
1040 return pdfContext->fGraphicsState.fSMask; 1170 return pdfContext->fGraphicsState.fSMask;
1041 } 1171 }
1042 1172
1043 PdfResult doXObject_Image(PdfContext* pdfContext, SkCanvas* canvas, const SkPdfI mage* skpdfimage) { 1173 PdfResult doXObject_Image(PdfContext* pdfContext, SkCanvas* canvas, const SkPdfI mageDictionary* skpdfimage) {
1044 if (skpdfimage == NULL || !skpdfimage->valid()) { 1174 if (skpdfimage == NULL || !skpdfimage->valid()) {
1045 return kIgnoreError_PdfResult; 1175 return kIgnoreError_PdfResult;
1046 } 1176 }
1047 1177
1048 SkBitmap image = getImageFromObject(pdfContext, skpdfimage, false); 1178 SkBitmap image = getImageFromObject(pdfContext, skpdfimage, false);
1049 SkBitmap sMask = getSmaskFromObject(pdfContext, skpdfimage); 1179 SkBitmap sMask = getSmaskFromObject(pdfContext, skpdfimage);
1050 1180
1051 canvas->save(); 1181 canvas->save();
1052 canvas->setMatrix(pdfContext->fGraphicsState.fMatrix); 1182 canvas->setMatrix(pdfContext->fGraphicsState.fMatrix);
1053 SkRect dst = SkRect::MakeXYWH(SkDoubleToScalar(0.0), SkDoubleToScalar(0.0), SkDoubleToScalar(1.0), SkDoubleToScalar(1.0)); 1183 SkRect dst = SkRect::MakeXYWH(SkDoubleToScalar(0.0), SkDoubleToScalar(0.0), SkDoubleToScalar(1.0), SkDoubleToScalar(1.0));
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 PdfResult doXObject(PdfContext* pdfContext, SkCanvas* canvas, const PdfObject& o bj) { 1341 PdfResult doXObject(PdfContext* pdfContext, SkCanvas* canvas, const PdfObject& o bj) {
1212 if (CheckRecursiveRendering::IsInRendering(obj)) { 1342 if (CheckRecursiveRendering::IsInRendering(obj)) {
1213 // Oops, corrupt PDF! 1343 // Oops, corrupt PDF!
1214 return kIgnoreError_PdfResult; 1344 return kIgnoreError_PdfResult;
1215 } 1345 }
1216 1346
1217 CheckRecursiveRendering checkRecursion(obj); 1347 CheckRecursiveRendering checkRecursion(obj);
1218 1348
1219 // TODO(edisonn): check type 1349 // TODO(edisonn): check type
1220 SkPdfObject* skobj = NULL; 1350 SkPdfObject* skobj = NULL;
1221 if (!PodofoMapper::mapObject(*pdfContext->fPdfDoc, obj, &skobj)) return kIgn oreError_PdfResult; 1351 if (!PodofoMapper::mapXObjectDictionary(*pdfContext->fPdfDoc, obj, &skobj)) return kIgnoreError_PdfResult;
1222 1352
1223 if (!skobj || !skobj->valid()) return kIgnoreError_PdfResult; 1353 if (!skobj || !skobj->valid()) return kIgnoreError_PdfResult;
1224 1354
1225 PdfResult ret = kIgnoreError_PdfResult; 1355 PdfResult ret = kIgnoreError_PdfResult;
1226 switch (skobj->getType()) 1356 switch (skobj->getType())
1227 { 1357 {
1228 case kObjectDictionaryXObjectImage_SkPdfObjectType: 1358 case kObjectDictionaryXObjectDictionaryImageDictionary_SkPdfObjectType:
1229 ret = doXObject_Image(pdfContext, canvas, skobj->asImage()); 1359 ret = doXObject_Image(pdfContext, canvas, skobj->asImageDictionary() );
1230 break; 1360 break;
1231 case kObjectDictionaryXObjectForm_SkPdfObjectType: 1361 case kObjectDictionaryXObjectDictionaryType1FormDictionary_SkPdfObjectTy pe:
1232 ret = doXObject_Form(pdfContext, canvas, obj); 1362 ret = doXObject_Form(pdfContext, canvas, obj);//skobj->asType1FormDi ctionary());
1233 break; 1363 break;
1234 //case kObjectDictionaryXObjectPS_SkPdfObjectType: 1364 //case kObjectDictionaryXObjectPS_SkPdfObjectType:
1235 //return doXObject_PS(skxobj.asPS()); 1365 //return doXObject_PS(skxobj.asPS());
1236 } 1366 }
1237 1367
1238 delete skobj; 1368 delete skobj;
1239 return ret; 1369 return ret;
1240 } 1370 }
1241 1371
1242 PdfResult PdfOp_q(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLooper** loo per) { 1372 PdfResult PdfOp_q(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLooper** loo per) {
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 pdfContext->fVarStack.pop(); 2094 pdfContext->fVarStack.pop();
1965 2095
1966 return kNYI_PdfResult; 2096 return kNYI_PdfResult;
1967 } 2097 }
1968 2098
1969 //dictName gs (PDF 1.2) Set the specified parameters in the graphics state. dictN ame is 2099 //dictName gs (PDF 1.2) Set the specified parameters in the graphics state. dictN ame is
1970 //the name of a graphics state parameter dictionary in the ExtGState subdictiona ry of the current resource dictionary (see the next section). 2100 //the name of a graphics state parameter dictionary in the ExtGState subdictiona ry of the current resource dictionary (see the next section).
1971 PdfResult PdfOp_gs(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLooper** lo oper) { 2101 PdfResult PdfOp_gs(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLooper** lo oper) {
1972 PdfName name = pdfContext->fVarStack.top().GetName(); pdfContext->fVarSta ck.pop(); 2102 PdfName name = pdfContext->fVarStack.top().GetName(); pdfContext->fVarSta ck.pop();
1973 2103
2104 #ifdef PDF_TRACE
2105 std::string str;
2106 #endif
2107
1974 const PdfDictionary& pageDict = pdfContext->fGraphicsState.fObjectWithResour ces->GetDictionary(); 2108 const PdfDictionary& pageDict = pdfContext->fGraphicsState.fObjectWithResour ces->GetDictionary();
2109
2110 #ifdef PDF_TRACE
2111 pdfContext->fGraphicsState.fObjectWithResources->ToString(str);
2112 printf("Print Object with resources: %s\n", str.c_str());
2113 #endif
2114
1975 const PdfObject* resources = resolveReferenceObject(pdfContext->fPdfDoc, 2115 const PdfObject* resources = resolveReferenceObject(pdfContext->fPdfDoc,
1976 pageDict.GetKey("Resourc es")); 2116 pageDict.GetKey("Resourc es"));
1977 2117
1978 if (resources == NULL) { 2118 if (resources == NULL) {
1979 #ifdef PDF_TRACE 2119 #ifdef PDF_TRACE
1980 printf("WARNING: No Resources for a page with 'gs' operator!\n"); 2120 printf("WARNING: No Resources for a page with 'gs' operator!\n");
1981 #endif 2121 #endif
1982 return kIgnoreError_PdfResult; 2122 return kIgnoreError_PdfResult;
1983 } 2123 }
1984 2124
1985 #ifdef PDF_TRACE 2125 #ifdef PDF_TRACE
1986 std::string str;
1987 resources->ToString(str); 2126 resources->ToString(str);
1988 printf("Print gs Page Resources: %s\n", str.c_str()); 2127 printf("Print gs Page Resources: %s\n", str.c_str());
1989 #endif 2128 #endif
1990 2129
1991 if (!resources->IsDictionary()) { 2130 if (!resources->IsDictionary()) {
1992 #ifdef PDF_TRACE 2131 #ifdef PDF_TRACE
1993 printf("Resources is not a dictionary!\n"); 2132 printf("Resources is not a dictionary!\n");
1994 #endif 2133 #endif
1995 return kIgnoreError_PdfResult; 2134 return kIgnoreError_PdfResult;
1996 } 2135 }
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2776 } 2915 }
2777 2916
2778 return 0; 2917 return 0;
2779 } 2918 }
2780 2919
2781 #if !defined SK_BUILD_FOR_IOS 2920 #if !defined SK_BUILD_FOR_IOS
2782 int main(int argc, char * const argv[]) { 2921 int main(int argc, char * const argv[]) {
2783 return tool_main(argc, (char**) argv); 2922 return tool_main(argc, (char**) argv);
2784 } 2923 }
2785 #endif 2924 #endif
OLDNEW
« no previous file with comments | « experimental/PdfViewer/generate_code.py ('k') | experimental/PdfViewer/pdfspec_autogen.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698