| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkPdfNativeObject.h" | 8 #include "SkPdfNativeObject.h" |
| 9 | 9 |
| 10 // TODO(edisonn): mac builder does not find the header ... but from headers is o
k | 10 // TODO(edisonn): mac builder does not find the header ... but from headers is o
k |
| 11 //#include "SkPdfStreamCommonDictionary_autogen.h" | 11 //#include "SkPdfStreamCommonDictionary_autogen.h" |
| 12 #include "SkPdfHeaders_autogen.h" | 12 #include "SkPdfHeaders_autogen.h" |
| 13 | 13 |
| 14 #include "SkFlate.h" | 14 #include "SkFlate.h" |
| 15 #include "SkStream.h" | 15 #include "SkStream.h" |
| 16 #include "SkPdfNativeTokenizer.h" | 16 #include "SkPdfNativeTokenizer.h" |
| 17 | 17 |
| 18 #include "SkBitmap.h" | 18 #include "SkBitmap.h" |
| 19 #include "SkPdfFont.h" | 19 #include "SkPdfFont.h" |
| 20 | 20 |
| 21 #include "SkPdfReporter.h" | 21 #include "SkPdfReporter.h" |
| 22 | 22 |
| 23 SkPdfNativeObject SkPdfNativeObject::kNull = SkPdfNativeObject::makeNull(PUT_TRA
CK_PARAMETERS_SRC0); | 23 SkPdfNativeObject SkPdfNativeObject::kNull = SkPdfNativeObject::makeNull(); |
| 24 | 24 |
| 25 bool SkPdfNativeObject::applyFlateDecodeFilter() { | 25 bool SkPdfNativeObject::applyFlateDecodeFilter() { |
| 26 if (!SkFlate::HaveFlate()) { | 26 if (!SkFlate::HaveFlate()) { |
| 27 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kNoFlateLibrary_SkPdfIssue,
"forgot to link with flate library?", NULL, NULL); | 27 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kNoFlateLibrary_SkPdfIssue,
"forgot to link with flate library?", NULL, NULL); |
| 28 return false; | 28 return false; |
| 29 } | 29 } |
| 30 | 30 |
| 31 const unsigned char* old = fStr.fBuffer; | 31 const unsigned char* old = fStr.fBuffer; |
| 32 bool deleteOld = isStreamOwned(); | 32 bool deleteOld = isStreamOwned(); |
| 33 | 33 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kIncositentSyntax_S
kPdfIssue, "filter name should be a Name", this, NULL); | 99 SkPdfReport(kIgnoreError_SkPdfIssueSeverity, kIncositentSyntax_S
kPdfIssue, "filter name should be a Name", this, NULL); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void SkPdfNativeObject::releaseData() { | 107 void SkPdfNativeObject::releaseData() { |
| 108 #ifdef PDF_TRACK_OBJECT_USAGE | 108 #ifdef PDF_TRACK_OBJECT_USAGE |
| 109 SkPdfReportIf(!fUsed, kInfo_SkPdfIssueSeverity, NULL, this, "Unused object i
n rendering"); | 109 SkPdfReportIf(!fUsed, kInfo_SkPdfIssueSeverity, kNoIssue_SkPdfIssue, "Unused
object in rendering", this, NULL); |
| 110 #endif // PDF_TRACK_OBJECT_USAGE | 110 #endif // PDF_TRACK_OBJECT_USAGE |
| 111 | 111 |
| 112 SkPdfMarkObjectUnused(); | 112 SkPdfMarkObjectUnused(); |
| 113 | 113 |
| 114 if (fData) { | 114 if (fData) { |
| 115 switch (fDataType) { | 115 switch (fDataType) { |
| 116 case kFont_Data: | 116 case kFont_Data: |
| 117 delete (SkPdfFont*)fData; | 117 delete (SkPdfFont*)fData; |
| 118 break; | 118 break; |
| 119 case kBitmap_Data: | 119 case kBitmap_Data: |
| 120 delete (SkBitmap*)fData; | 120 delete (SkBitmap*)fData; |
| 121 break; | 121 break; |
| 122 default: | 122 default: |
| 123 SkASSERT(false); | 123 SkASSERT(false); |
| 124 break; | 124 break; |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 fData = NULL; | 127 fData = NULL; |
| 128 fDataType = kEmpty_Data; | 128 fDataType = kEmpty_Data; |
| 129 } | 129 } |
| OLD | NEW |