Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 #ifndef SkStream_DEFINED | 8 #ifndef SkStream_DEFINED |
| 9 #define SkStream_DEFINED | 9 #define SkStream_DEFINED |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 /** Duplicates this stream. If this cannot be done, returns NULL. | 119 /** Duplicates this stream. If this cannot be done, returns NULL. |
| 120 * The returned stream will be positioned the same as this stream. | 120 * The returned stream will be positioned the same as this stream. |
| 121 */ | 121 */ |
| 122 virtual SkStreamSeekable* fork() const { return NULL; } | 122 virtual SkStreamSeekable* fork() const { return NULL; } |
| 123 | 123 |
| 124 //SkStreamAsset | 124 //SkStreamAsset |
| 125 /** Returns true if this stream can report it's total length. */ | 125 /** Returns true if this stream can report it's total length. */ |
| 126 virtual bool hasLength() const { return false; } | 126 virtual bool hasLength() const { return false; } |
| 127 /** Returns the total length of the stream. If this cannot be done, returns 0. */ | 127 /** Returns the total length of the stream. If this cannot be done, returns 0. */ |
| 128 virtual size_t getLength() const { return 0; } | 128 virtual size_t getLength() const { return 0; } |
| 129 /** Returns a ref to the data, if it can be created | |
| 130 inexpensively. If non-null is returned, the caller is | |
| 131 responsible for calling unref() on the data when it is | |
| 132 finished. */ | |
| 133 virtual SkData* getData() const { return NULL; } | |
|
bungeman-skia
2013/12/05 21:03:44
I would put this down with SkStreamMemory, replaci
hal.canary
2013/12/05 22:29:29
Done.
| |
| 129 | 134 |
| 130 //SkStreamMemory | 135 //SkStreamMemory |
| 131 /** Returns the starting address for the data. If this cannot be done, retur ns NULL. */ | 136 /** Returns the starting address for the data. If this cannot be done, retur ns NULL. */ |
| 132 //TODO: replace with virtual const SkData* getData() | 137 //TODO: replace with virtual const SkData* getData() |
| 133 virtual const void* getMemoryBase() { return NULL; } | 138 virtual const void* getMemoryBase() { return NULL; } |
| 134 | 139 |
| 135 private: | 140 private: |
| 136 typedef SkRefCnt INHERITED; | 141 typedef SkRefCnt INHERITED; |
| 137 }; | 142 }; |
| 138 | 143 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 164 virtual bool hasLength() const SK_OVERRIDE { return true; } | 169 virtual bool hasLength() const SK_OVERRIDE { return true; } |
| 165 virtual size_t getLength() const SK_OVERRIDE = 0; | 170 virtual size_t getLength() const SK_OVERRIDE = 0; |
| 166 }; | 171 }; |
| 167 | 172 |
| 168 /** SkStreamMemory is a SkStreamAsset for which getMemoryBase is required. */ | 173 /** SkStreamMemory is a SkStreamAsset for which getMemoryBase is required. */ |
| 169 class SK_API SkStreamMemory : public SkStreamAsset { | 174 class SK_API SkStreamMemory : public SkStreamAsset { |
| 170 public: | 175 public: |
| 171 virtual SkStreamMemory* duplicate() const SK_OVERRIDE = 0; | 176 virtual SkStreamMemory* duplicate() const SK_OVERRIDE = 0; |
| 172 virtual SkStreamMemory* fork() const SK_OVERRIDE = 0; | 177 virtual SkStreamMemory* fork() const SK_OVERRIDE = 0; |
| 173 | 178 |
| 174 virtual const void* getMemoryBase() SK_OVERRIDE = 0; | 179 virtual const void* getMemoryBase() SK_OVERRIDE = 0; |
|
bungeman-skia
2013/12/05 21:03:44
virtual SkData* getData() const SK_OVERRIDE = 0;
hal.canary
2013/12/05 22:29:29
Done.
| |
| 175 }; | 180 }; |
| 176 | 181 |
| 177 class SK_API SkWStream : SkNoncopyable { | 182 class SK_API SkWStream : SkNoncopyable { |
| 178 public: | 183 public: |
| 179 SK_DECLARE_INST_COUNT_ROOT(SkWStream) | 184 SK_DECLARE_INST_COUNT_ROOT(SkWStream) |
| 180 | 185 |
| 181 virtual ~SkWStream(); | 186 virtual ~SkWStream(); |
| 182 | 187 |
| 183 /** Called to write bytes to a SkWStream. Returns true on success | 188 /** Called to write bytes to a SkWStream. Returns true on success |
| 184 @param buffer the address of at least size bytes to be written to the st ream | 189 @param buffer the address of at least size bytes to be written to the st ream |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 virtual bool rewind() SK_OVERRIDE; | 267 virtual bool rewind() SK_OVERRIDE; |
| 263 virtual SkStreamAsset* duplicate() const SK_OVERRIDE; | 268 virtual SkStreamAsset* duplicate() const SK_OVERRIDE; |
| 264 | 269 |
| 265 virtual size_t getPosition() const SK_OVERRIDE; | 270 virtual size_t getPosition() const SK_OVERRIDE; |
| 266 virtual bool seek(size_t position) SK_OVERRIDE; | 271 virtual bool seek(size_t position) SK_OVERRIDE; |
| 267 virtual bool move(long offset) SK_OVERRIDE; | 272 virtual bool move(long offset) SK_OVERRIDE; |
| 268 virtual SkStreamAsset* fork() const SK_OVERRIDE; | 273 virtual SkStreamAsset* fork() const SK_OVERRIDE; |
| 269 | 274 |
| 270 virtual size_t getLength() const SK_OVERRIDE; | 275 virtual size_t getLength() const SK_OVERRIDE; |
| 271 | 276 |
| 277 virtual SkData* getData() const SK_OVERRIDE; | |
| 272 virtual const void* getMemoryBase() SK_OVERRIDE; | 278 virtual const void* getMemoryBase() SK_OVERRIDE; |
| 273 | 279 |
| 274 private: | 280 private: |
| 275 SkFILE* fFILE; | 281 SkFILE* fFILE; |
| 276 SkString fName; | 282 SkString fName; |
| 277 Ownership fOwnership; | 283 Ownership fOwnership; |
| 278 // fData is lazilly initialized when needed. | 284 // fData is lazilly initialized when needed. |
| 279 mutable SkAutoTUnref<SkData> fData; | 285 mutable SkAutoTUnref<SkData> fData; |
| 280 | 286 |
| 281 typedef SkStreamAsset INHERITED; | 287 typedef SkStreamAsset INHERITED; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 virtual bool rewind() SK_OVERRIDE; | 340 virtual bool rewind() SK_OVERRIDE; |
| 335 virtual SkMemoryStream* duplicate() const SK_OVERRIDE; | 341 virtual SkMemoryStream* duplicate() const SK_OVERRIDE; |
| 336 | 342 |
| 337 virtual size_t getPosition() const SK_OVERRIDE; | 343 virtual size_t getPosition() const SK_OVERRIDE; |
| 338 virtual bool seek(size_t position) SK_OVERRIDE; | 344 virtual bool seek(size_t position) SK_OVERRIDE; |
| 339 virtual bool move(long offset) SK_OVERRIDE; | 345 virtual bool move(long offset) SK_OVERRIDE; |
| 340 virtual SkMemoryStream* fork() const SK_OVERRIDE; | 346 virtual SkMemoryStream* fork() const SK_OVERRIDE; |
| 341 | 347 |
| 342 virtual size_t getLength() const SK_OVERRIDE; | 348 virtual size_t getLength() const SK_OVERRIDE; |
| 343 | 349 |
| 350 virtual SkData* getData() const SK_OVERRIDE; | |
| 344 virtual const void* getMemoryBase() SK_OVERRIDE; | 351 virtual const void* getMemoryBase() SK_OVERRIDE; |
| 345 | 352 |
| 346 private: | 353 private: |
| 347 SkData* fData; | 354 SkData* fData; |
| 348 size_t fOffset; | 355 size_t fOffset; |
| 349 | 356 |
| 350 typedef SkStreamMemory INHERITED; | 357 typedef SkStreamMemory INHERITED; |
| 351 }; | 358 }; |
| 352 | 359 |
| 353 //////////////////////////////////////////////////////////////////////////////// ///////////// | 360 //////////////////////////////////////////////////////////////////////////////// ///////////// |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 virtual void newline() SK_OVERRIDE; | 451 virtual void newline() SK_OVERRIDE; |
| 445 | 452 |
| 446 private: | 453 private: |
| 447 typedef SkWStream INHERITED; | 454 typedef SkWStream INHERITED; |
| 448 }; | 455 }; |
| 449 | 456 |
| 450 // for now | 457 // for now |
| 451 typedef SkFILEStream SkURLStream; | 458 typedef SkFILEStream SkURLStream; |
| 452 | 459 |
| 453 #endif | 460 #endif |
| OLD | NEW |