| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
| 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 | 8 |
| 9 #ifndef SkPDFTypes_DEFINED | 9 #ifndef SkPDFTypes_DEFINED |
| 10 #define SkPDFTypes_DEFINED | 10 #define SkPDFTypes_DEFINED |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 SkPDFUnion(const SkPDFUnion&) = delete; | 161 SkPDFUnion(const SkPDFUnion&) = delete; |
| 162 }; | 162 }; |
| 163 static_assert(sizeof(SkString) == sizeof(void*), "SkString_size"); | 163 static_assert(sizeof(SkString) == sizeof(void*), "SkString_size"); |
| 164 | 164 |
| 165 //////////////////////////////////////////////////////////////////////////////// | 165 //////////////////////////////////////////////////////////////////////////////// |
| 166 | 166 |
| 167 #if 0 // Enable if needed. | 167 #if 0 // Enable if needed. |
| 168 /** This class is a SkPDFUnion with SkPDFObject virtuals attached. | 168 /** This class is a SkPDFUnion with SkPDFObject virtuals attached. |
| 169 The only use case of this is when a non-compound PDF object is | 169 The only use case of this is when a non-compound PDF object is |
| 170 referenced indirectly. */ | 170 referenced indirectly. */ |
| 171 class SkPDFAtom : public SkPDFObject { | 171 class SkPDFAtom final : public SkPDFObject { |
| 172 public: | 172 public: |
| 173 void emitObject(SkWStream* stream, | 173 void emitObject(SkWStream* stream, |
| 174 const SkPDFObjNumMap& objNumMap, | 174 const SkPDFObjNumMap& objNumMap, |
| 175 const SkPDFSubstituteMap& substitutes) final; | 175 const SkPDFSubstituteMap& substitutes) final; |
| 176 void addResources(SkPDFObjNumMap*, const SkPDFSubstituteMap&) const final; | 176 void addResources(SkPDFObjNumMap*, const SkPDFSubstituteMap&) const final; |
| 177 SkPDFAtom(SkPDFUnion&& v) : fValue(v.move()) {} | 177 SkPDFAtom(SkPDFUnion&& v) : fValue(v.move()) {} |
| 178 | 178 |
| 179 private: | 179 private: |
| 180 const SkPDFUnion fValue; | 180 const SkPDFUnion fValue; |
| 181 typedef SkPDFObject INHERITED; | 181 typedef SkPDFObject INHERITED; |
| 182 }; | 182 }; |
| 183 #endif // 0 | 183 #endif // 0 |
| 184 | 184 |
| 185 //////////////////////////////////////////////////////////////////////////////// | 185 //////////////////////////////////////////////////////////////////////////////// |
| 186 | 186 |
| 187 /** \class SkPDFArray | 187 /** \class SkPDFArray |
| 188 | 188 |
| 189 An array object in a PDF. | 189 An array object in a PDF. |
| 190 */ | 190 */ |
| 191 class SkPDFArray : public SkPDFObject { | 191 class SkPDFArray final : public SkPDFObject { |
| 192 public: | 192 public: |
| 193 static const int kMaxLen = 8191; | 193 static const int kMaxLen = 8191; |
| 194 | 194 |
| 195 /** Create a PDF array. Maximum length is 8191. | 195 /** Create a PDF array. Maximum length is 8191. |
| 196 */ | 196 */ |
| 197 SkPDFArray(); | 197 SkPDFArray(); |
| 198 virtual ~SkPDFArray(); | 198 virtual ~SkPDFArray(); |
| 199 | 199 |
| 200 // The SkPDFObject interface. | 200 // The SkPDFObject interface. |
| 201 void emitObject(SkWStream* stream, | 201 void emitObject(SkWStream* stream, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 typedef SkPDFObject INHERITED; | 307 typedef SkPDFObject INHERITED; |
| 308 }; | 308 }; |
| 309 | 309 |
| 310 /** \class SkPDFSharedStream | 310 /** \class SkPDFSharedStream |
| 311 | 311 |
| 312 This class takes an asset and assumes that it is backed by | 312 This class takes an asset and assumes that it is backed by |
| 313 long-lived shared data (for example, an open file | 313 long-lived shared data (for example, an open file |
| 314 descriptor). That is: no memory savings can be made by holding on | 314 descriptor). That is: no memory savings can be made by holding on |
| 315 to a compressed version instead. | 315 to a compressed version instead. |
| 316 */ | 316 */ |
| 317 class SkPDFSharedStream : public SkPDFObject { | 317 class SkPDFSharedStream final : public SkPDFObject { |
| 318 public: | 318 public: |
| 319 // Takes ownership of asset. | 319 // Takes ownership of asset. |
| 320 SkPDFSharedStream(SkStreamAsset* data) : fAsset(data), fDict(new SkPDFDict)
{ SkASSERT(data); } | 320 SkPDFSharedStream(SkStreamAsset* data) : fAsset(data), fDict(new SkPDFDict)
{ SkASSERT(data); } |
| 321 SkPDFDict* dict() { return fDict; } | 321 SkPDFDict* dict() { return fDict; } |
| 322 void emitObject(SkWStream*, | 322 void emitObject(SkWStream*, |
| 323 const SkPDFObjNumMap&, | 323 const SkPDFObjNumMap&, |
| 324 const SkPDFSubstituteMap&) const override; | 324 const SkPDFSubstituteMap&) const override; |
| 325 void addResources(SkPDFObjNumMap*, | 325 void addResources(SkPDFObjNumMap*, |
| 326 const SkPDFSubstituteMap&) const override; | 326 const SkPDFSubstituteMap&) const override; |
| 327 | 327 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 }; | 393 }; |
| 394 | 394 |
| 395 #ifdef SK_PDF_IMAGE_STATS | 395 #ifdef SK_PDF_IMAGE_STATS |
| 396 extern SkAtomic<int> gDrawImageCalls; | 396 extern SkAtomic<int> gDrawImageCalls; |
| 397 extern SkAtomic<int> gJpegImageObjects; | 397 extern SkAtomic<int> gJpegImageObjects; |
| 398 extern SkAtomic<int> gRegularImageObjects; | 398 extern SkAtomic<int> gRegularImageObjects; |
| 399 extern void SkPDFImageDumpStats(); | 399 extern void SkPDFImageDumpStats(); |
| 400 #endif // SK_PDF_IMAGE_STATS | 400 #endif // SK_PDF_IMAGE_STATS |
| 401 | 401 |
| 402 #endif | 402 #endif |
| OLD | NEW |