edisonn@google.com | 67d7fb4 | 2013-10-07 15:40:21 +0000 | [diff] [blame] | 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 | |
| 9 | #ifndef SkPdfReporter_DEFINED |
| 10 | #define SkPdfReporter_DEFINED |
| 11 | |
| 12 | #include "SkPdfConfig.h" |
| 13 | |
| 14 | class SkPdfNativeObject; |
| 15 | class SkPdfContext; |
| 16 | |
edisonn@google.com | e50d9a1 | 2013-10-10 20:58:22 +0000 | [diff] [blame^] | 17 | // TODO(edisonn): ability to turn on asserts for known good files |
| 18 | |
edisonn@google.com | 67d7fb4 | 2013-10-07 15:40:21 +0000 | [diff] [blame] | 19 | enum SkPdfIssueSeverity { |
| 20 | kInfo_SkPdfIssueSeverity, |
edisonn@google.com | e50d9a1 | 2013-10-10 20:58:22 +0000 | [diff] [blame^] | 21 | kCodeWarning_SkPdfIssueSeverity, // e.g. like NYI, PDF file is Ok. |
edisonn@google.com | 67d7fb4 | 2013-10-07 15:40:21 +0000 | [diff] [blame] | 22 | kWarning_SkPdfIssueSeverity, |
| 23 | kIgnoreError_SkPdfIssueSeverity, |
| 24 | kError_SkPdfIssueSeverity, |
| 25 | kFatalError_SkPdfIssueSeverity, |
| 26 | |
| 27 | _kCount__SkPdfIssueSeverity |
| 28 | }; |
| 29 | |
| 30 | enum SkPdfIssue { |
| 31 | kNoIssue_SkPdfIssue, |
| 32 | |
| 33 | kNullObject_SkPdfIssue, |
| 34 | kUnexpectedArraySize_SkPdfIssue, |
| 35 | kMissingEncoding_SkPdfIssue, |
| 36 | kNYI_SkPdfIssue, |
| 37 | kIncostistentSizes_SkPdfIssue, |
| 38 | kMissingRequiredKey_SkPdfIssue, |
| 39 | kRecursiveReferencing_SkPdfIssue, |
| 40 | kStackNestingOverflow_SkPdfIssue, |
| 41 | kStackOverflow_SkPdfIssue, |
| 42 | kIncositentSyntax_SkPdfIssue, |
| 43 | kMissingFont_SkPdfIssue, |
| 44 | kInvalidFont_SkPdfIssue, |
| 45 | kMissingBT_SkPdfIssue, |
| 46 | kOutOfRange_SkPdfIssue, |
| 47 | kUnknownBlendMode_SkPdfIssue, |
| 48 | kMissingExtGState_SkPdfIssue, |
| 49 | kMissingXObject_SkPdfIssue, |
| 50 | kReadStreamError_SkPdfIssue, |
| 51 | kMissingToken_SkPdfIssue, |
| 52 | kBadReference_SkPdfIssue, |
| 53 | kNoFlateLibrary_SkPdfIssue, |
| 54 | kBadStream_SkPdfIssue, |
| 55 | |
edisonn@google.com | 67d7fb4 | 2013-10-07 15:40:21 +0000 | [diff] [blame] | 56 | _kCount__SkPdfIssue |
| 57 | }; |
| 58 | |
| 59 | #ifdef PDF_REPORT |
| 60 | |
edisonn@google.com | e50d9a1 | 2013-10-10 20:58:22 +0000 | [diff] [blame^] | 61 | void SkPdfReportIf(bool report, |
| 62 | SkPdfIssueSeverity sev, SkPdfIssue issue, |
| 63 | const char* context, |
| 64 | const SkPdfNativeObject* obj, |
| 65 | SkPdfContext* pdfContext); |
| 66 | void SkPdfReport(SkPdfIssueSeverity sev, SkPdfIssue issue, |
| 67 | const char* context, |
| 68 | const SkPdfNativeObject* obj, |
| 69 | SkPdfContext* pdfContext); |
| 70 | void SkPdfReportUnexpectedType(SkPdfIssueSeverity sev, |
| 71 | const char* context, |
| 72 | const SkPdfNativeObject* obj, int anyOfTypes, |
| 73 | SkPdfContext* pdfContext); |
edisonn@google.com | 67d7fb4 | 2013-10-07 15:40:21 +0000 | [diff] [blame] | 74 | #define SkPdfREPORTCODE(code) code |
| 75 | |
| 76 | #else // !PDF_REPORT |
| 77 | |
| 78 | #define SkPdfReportIf(a,b,c,d,e,f) |
| 79 | #define SkPdfReport(a,b,c,d,e) |
| 80 | #define SkPdfReportUnexpectedType(a,b,c,d,e) |
| 81 | #define SkPdfREPORTCODE(code) |
| 82 | |
| 83 | #endif // PDF_REPORT |
| 84 | |
| 85 | #endif // SkPdfReporter_DEFINED |