| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2013 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkPdfConfig_DEFINED | |
| 9 #define SkPdfConfig_DEFINED | |
| 10 | |
| 11 #include "stddef.h" | |
| 12 class SkPdfNativeObject; | |
| 13 | |
| 14 // shows what objects have not been used in rendering. can be used to track what
features we might | |
| 15 // have not implemented, or where we implemented only the default behaivour | |
| 16 //#define PDF_TRACK_OBJECT_USAGE | |
| 17 | |
| 18 // tracks the position in the stream, it can be used to show where exactly the e
rrors happened | |
| 19 //#define PDF_TRACK_STREAM_OFFSETS | |
| 20 | |
| 21 // reports issues, warning, NYI, errors, ... | |
| 22 // enable PDF_TRACK_STREAM_OFFSETS to also have the offset in the stream where t
he error happened | |
| 23 //#define PDF_REPORT | |
| 24 | |
| 25 // At various points in code we show the value of important variables with this
flag | |
| 26 //#define PDF_TRACE | |
| 27 | |
| 28 // displays the result of each read token, individual result | |
| 29 //#define PDF_TRACE_READ_TOKEN | |
| 30 | |
| 31 // Every drawtext draws before a rectangle, in this way we see the one that migh
t have failed | |
| 32 //#define PDF_TRACE_DRAWTEXT | |
| 33 | |
| 34 // For each render operations, it will dump the canvas in a png | |
| 35 //#define PDF_TRACE_DIFF_IN_PNG | |
| 36 | |
| 37 // Does not clip at all, can be used in debugging issues | |
| 38 //#define PDF_DEBUG_NO_CLIPING | |
| 39 | |
| 40 // Does not click the page, use is with 3x | |
| 41 //#define PDF_DEBUG_NO_PAGE_CLIPING | |
| 42 | |
| 43 // render the page 3X bigger (with content in center) - used to make sure we don
't mess up | |
| 44 // positioning | |
| 45 // like a tick tac toe board, only the center one has content, all the rest of t
hem have to be clean | |
| 46 //#define PDF_DEBUG_3X | |
| 47 | |
| 48 | |
| 49 // TODO(edisonn): pass a flag to say how it was used? e.g. asked the type? Obtai
ned value? | |
| 50 // Implement it when it will be needed the first time to fix some bug. | |
| 51 #ifdef PDF_TRACK_OBJECT_USAGE | |
| 52 #define SkPdfMarkObjectUsed() fUsed = true | |
| 53 #else | |
| 54 #define SkPdfMarkObjectUsed() | |
| 55 #endif // PDF_TRACK_OBJECT_USAGE | |
| 56 | |
| 57 #ifdef PDF_TRACK_OBJECT_USAGE | |
| 58 #define SkPdfMarkObjectUnused() fUsed = false | |
| 59 #else | |
| 60 #define SkPdfMarkObjectUnused() | |
| 61 #endif // PDF_TRACK_OBJECT_USAGE | |
| 62 | |
| 63 #ifdef PDF_TRACK_STREAM_OFFSETS | |
| 64 #define TRACK_OBJECT_SRC(a) | |
| 65 #define STORE_TRACK_PARAMETERS(obj) (obj)->fStreamId = streamId;\ | |
| 66 (obj)->fOffsetStart = offsetStart;\ | |
| 67 (obj)->fOffsetEnd = offsetEnd; | |
| 68 #define STORE_TRACK_PARAMETER_OFFSET_END(obj,offsetEnd) (obj)->fOffsetEnd = (off
setEnd)-streamStart; | |
| 69 #else | |
| 70 #define TRACK_OBJECT_SRC(a) | |
| 71 #define STORE_TRACK_PARAMETERS(obj) | |
| 72 #define STORE_TRACK_PARAMETER_OFFSET_END(obj,offsetEnd) | |
| 73 #endif //PDF_TRACK_STREAM_OFFSETS | |
| 74 | |
| 75 // TODO(edisonn): move it somewhere else? | |
| 76 struct SkPdfInputStream { | |
| 77 #ifdef PDF_TRACK_STREAM_OFFSETS | |
| 78 // no parent object -> original file to be rendered | |
| 79 // no parent file -> stream object | |
| 80 // both -> external stream object | |
| 81 int fParentFileID; | |
| 82 const SkPdfNativeObject* fParentObject; | |
| 83 | |
| 84 size_t fDelta; // delta in parent stream | |
| 85 const unsigned char* fStart; | |
| 86 #endif // PDF_TRACK_STREAM_OFFSETS | |
| 87 | |
| 88 const unsigned char* fEnd; | |
| 89 }; | |
| 90 | |
| 91 struct SkPdfInputStreamLocation { | |
| 92 SkPdfInputStream fInputStream; | |
| 93 const unsigned char* fNow; | |
| 94 }; | |
| 95 | |
| 96 #ifdef PDF_TRACK_STREAM_OFFSETS | |
| 97 struct SkPdfInputStreamRange { | |
| 98 SkPdfInputStream fInputStream; | |
| 99 const unsigned char* fRangeStart; | |
| 100 const unsigned char* fRangeEnd; | |
| 101 }; | |
| 102 #endif // PDF_TRACK_STREAM_OFFSETS | |
| 103 | |
| 104 | |
| 105 #endif // SkPdfConfig_DEFINED | |
| OLD | NEW |