edisonn@google.com | b857a0c | 2013-06-25 20:45:40 +0000 | [diff] [blame] | 1 | #ifndef __DEFINED__SkPdfUtils |
| 2 | #define __DEFINED__SkPdfUtils |
| 3 | |
edisonn@google.com | 3aa3555 | 2013-08-14 18:26:20 +0000 | [diff] [blame] | 4 | #include "SkMatrix.h" |
| 5 | #include "SkRect.h" |
edisonn@google.com | 33f11b6 | 2013-08-14 21:35:27 +0000 | [diff] [blame^] | 6 | #include "SkPdfConfig.h" |
edisonn@google.com | b857a0c | 2013-06-25 20:45:40 +0000 | [diff] [blame] | 7 | |
edisonn@google.com | b857a0c | 2013-06-25 20:45:40 +0000 | [diff] [blame] | 8 | class SkPdfArray; |
edisonn@google.com | 3aa3555 | 2013-08-14 18:26:20 +0000 | [diff] [blame] | 9 | class SkPdfContext; |
| 10 | class SkCanvas; |
| 11 | class SkPdfNativeObject; |
| 12 | |
| 13 | // TODO(edisonn): temporary code, to report how much of the PDF we actually think we rendered. |
| 14 | enum 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 | |
| 25 | struct 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.com | b857a0c | 2013-06-25 20:45:40 +0000 | [diff] [blame] | 44 | |
edisonn@google.com | b857a0c | 2013-06-25 20:45:40 +0000 | [diff] [blame] | 45 | SkMatrix SkMatrixFromPdfArray(SkPdfArray* pdfArray); |
| 46 | |
edisonn@google.com | 3aa3555 | 2013-08-14 18:26:20 +0000 | [diff] [blame] | 47 | SkPdfResult 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 |
| 54 | void SkTraceMatrix(const SkMatrix& matrix, const char* sz); |
| 55 | void SkTraceRect(const SkRect& rect, const char* sz); |
| 56 | #else |
| 57 | #define SkTraceMatrix(a,b) |
| 58 | #define SkTraceRect(a,b) |
| 59 | #endif |
edisonn@google.com | b857a0c | 2013-06-25 20:45:40 +0000 | [diff] [blame] | 60 | |
edisonn@google.com | b857a0c | 2013-06-25 20:45:40 +0000 | [diff] [blame] | 61 | #endif // __DEFINED__SkPdfUtils |