| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 /** \class SkPDFSharedStream | 306 /** \class SkPDFSharedStream |
| 307 | 307 |
| 308 This class takes an asset and assumes that it is backed by | 308 This class takes an asset and assumes that it is backed by |
| 309 long-lived shared data (for example, an open file | 309 long-lived shared data (for example, an open file |
| 310 descriptor). That is: no memory savings can be made by holding on | 310 descriptor). That is: no memory savings can be made by holding on |
| 311 to a compressed version instead. | 311 to a compressed version instead. |
| 312 */ | 312 */ |
| 313 class SkPDFSharedStream : public SkPDFObject { | 313 class SkPDFSharedStream : public SkPDFObject { |
| 314 public: | 314 public: |
| 315 // Takes ownership of asset. | 315 // Takes ownership of asset. |
| 316 SkPDFSharedStream(SkStreamAsset* data) | 316 SkPDFSharedStream(SkStreamAsset* data) : fAsset(data), fDict(new SkPDFDict)
{ SkASSERT(data); } |
| 317 : fAsset(data), fDict(SkNEW(SkPDFDict)) { | |
| 318 SkASSERT(data); | |
| 319 } | |
| 320 SkPDFDict* dict() { return fDict; } | 317 SkPDFDict* dict() { return fDict; } |
| 321 void emitObject(SkWStream*, | 318 void emitObject(SkWStream*, |
| 322 const SkPDFObjNumMap&, | 319 const SkPDFObjNumMap&, |
| 323 const SkPDFSubstituteMap&) const override; | 320 const SkPDFSubstituteMap&) const override; |
| 324 void addResources(SkPDFObjNumMap*, | 321 void addResources(SkPDFObjNumMap*, |
| 325 const SkPDFSubstituteMap&) const override; | 322 const SkPDFSubstituteMap&) const override; |
| 326 | 323 |
| 327 private: | 324 private: |
| 328 SkAutoTDelete<SkStreamAsset> fAsset; | 325 SkAutoTDelete<SkStreamAsset> fAsset; |
| 329 SkAutoTUnref<SkPDFDict> fDict; | 326 SkAutoTUnref<SkPDFDict> fDict; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 376 |
| 380 SkPDFObject* operator()(SkPDFObject* o) const { | 377 SkPDFObject* operator()(SkPDFObject* o) const { |
| 381 return this->getSubstitute(o); | 378 return this->getSubstitute(o); |
| 382 } | 379 } |
| 383 | 380 |
| 384 private: | 381 private: |
| 385 SkTHashMap<SkPDFObject*, SkPDFObject*> fSubstituteMap; | 382 SkTHashMap<SkPDFObject*, SkPDFObject*> fSubstituteMap; |
| 386 }; | 383 }; |
| 387 | 384 |
| 388 #endif | 385 #endif |
| OLD | NEW |