blob: 31dfc0b95e4934ef81201233ec7661364af08f6a [file] [log] [blame]
edisonn@google.comb857a0c2013-06-25 20:45:40 +00001#ifndef __DEFINED__SkPdfUtils
2#define __DEFINED__SkPdfUtils
3
edisonn@google.com3aa35552013-08-14 18:26:20 +00004#include "SkMatrix.h"
5#include "SkRect.h"
edisonn@google.com33f11b62013-08-14 21:35:27 +00006#include "SkPdfConfig.h"
edisonn@google.comb857a0c2013-06-25 20:45:40 +00007
edisonn@google.comb857a0c2013-06-25 20:45:40 +00008class SkPdfArray;
edisonn@google.com3aa35552013-08-14 18:26:20 +00009class SkPdfContext;
10class SkCanvas;
11class SkPdfNativeObject;
12
13// TODO(edisonn): temporary code, to report how much of the PDF we actually think we rendered.
14enum SkPdfResult {
15 kOK_SkPdfResult,
16 kPartial_SkPdfResult,
17 kNYI_SkPdfResult,
18 kIgnoreError_SkPdfResult,
19 kError_SkPdfResult,
20 kUnsupported_SkPdfResult,
21
22 kCount_SkPdfResult
23};
24
25struct NotOwnedString {
26 const unsigned char* fBuffer;
27 size_t fBytes;
28
29 static void init(NotOwnedString* str) {
30 str->fBuffer = NULL;
31 str->fBytes = 0;
32 }
33
34 static void init(NotOwnedString* str, const char* sz) {
35 str->fBuffer = (const unsigned char*)sz;
36 str->fBytes = strlen(sz);
37 }
38
39 bool equals(const char* sz) {
40 return strncmp((const char*)fBuffer, sz, fBytes) == 0 && fBytes == strlen(sz);
41
42 }
43};
edisonn@google.comb857a0c2013-06-25 20:45:40 +000044
edisonn@google.comb857a0c2013-06-25 20:45:40 +000045SkMatrix SkMatrixFromPdfArray(SkPdfArray* pdfArray);
46
edisonn@google.com3aa35552013-08-14 18:26:20 +000047SkPdfResult doType3Char(SkPdfContext* pdfContext, SkCanvas* canvas, const SkPdfNativeObject* skobj, SkRect bBox, SkMatrix matrix, double textSize);
48
49////////////////////////////////////////////////////////////////////////////////////////////////////
50//
51// TRACE functions
52//
53#ifdef PDF_TRACE
54void SkTraceMatrix(const SkMatrix& matrix, const char* sz);
55void SkTraceRect(const SkRect& rect, const char* sz);
56#else
57#define SkTraceMatrix(a,b)
58#define SkTraceRect(a,b)
59#endif
edisonn@google.comb857a0c2013-06-25 20:45:40 +000060
edisonn@google.comb857a0c2013-06-25 20:45:40 +000061#endif // __DEFINED__SkPdfUtils