| 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 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (strcmp(name, "FlateDecode") == 0) { | 59 if (strcmp(name, "FlateDecode") == 0) { |
| 60 return applyFlateDecodeFilter(); | 60 return applyFlateDecodeFilter(); |
| 61 } else if (strcmp(name, "DCTDecode") == 0) { | 61 } else if (strcmp(name, "DCTDecode") == 0) { |
| 62 return applyDCTDecodeFilter(); | 62 return applyDCTDecodeFilter(); |
| 63 } | 63 } |
| 64 // TODO(edisonn): allert, not supported, but should be implemented asap | 64 // TODO(edisonn): allert, not supported, but should be implemented asap |
| 65 return false; | 65 return false; |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool SkPdfNativeObject::filterStream() { | 68 bool SkPdfNativeObject::filterStream() { |
| 69 SkPdfMarkObjectUsed(); |
| 70 |
| 69 if (!hasStream()) { | 71 if (!hasStream()) { |
| 70 return false; | 72 return false; |
| 71 } | 73 } |
| 72 | 74 |
| 73 if (isStreamFiltered()) { | 75 if (isStreamFiltered()) { |
| 74 return true; | 76 return true; |
| 75 } | 77 } |
| 76 | 78 |
| 77 SkPdfStreamCommonDictionary* stream = (SkPdfStreamCommonDictionary*)this; | 79 SkPdfStreamCommonDictionary* stream = (SkPdfStreamCommonDictionary*)this; |
| 78 | 80 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 93 } else { | 95 } else { |
| 94 // TODO(edisonn): report warning | 96 // TODO(edisonn): report warning |
| 95 } | 97 } |
| 96 } | 98 } |
| 97 } | 99 } |
| 98 | 100 |
| 99 return true; | 101 return true; |
| 100 } | 102 } |
| 101 | 103 |
| 102 void SkPdfNativeObject::releaseData() { | 104 void SkPdfNativeObject::releaseData() { |
| 105 // TODO(edisonn): report here unused objects |
| 106 |
| 107 SkPdfMarkObjectUnused(); |
| 108 |
| 103 if (fData) { | 109 if (fData) { |
| 104 switch (fDataType) { | 110 switch (fDataType) { |
| 105 case kFont_Data: | 111 case kFont_Data: |
| 106 delete (SkPdfFont*)fData; | 112 delete (SkPdfFont*)fData; |
| 107 break; | 113 break; |
| 108 case kBitmap_Data: | 114 case kBitmap_Data: |
| 109 delete (SkBitmap*)fData; | 115 delete (SkBitmap*)fData; |
| 110 break; | 116 break; |
| 111 default: | 117 default: |
| 112 SkASSERT(false); | 118 SkASSERT(false); |
| 113 break; | 119 break; |
| 114 } | 120 } |
| 115 } | 121 } |
| 116 fData = NULL; | 122 fData = NULL; |
| 117 fDataType = kEmpty_Data; | 123 fDataType = kEmpty_Data; |
| 118 } | 124 } |
| OLD | NEW |