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