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