| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef SkScanlineDecoder_DEFINED | 8 #ifndef SkScanlineDecoder_DEFINED |
| 9 #define SkScanlineDecoder_DEFINED | 9 #define SkScanlineDecoder_DEFINED |
| 10 | 10 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 #include "SkCodec.h" | 12 #include "SkCodec.h" |
| 13 #include "SkTemplates.h" | 13 #include "SkTemplates.h" |
| 14 #include "SkImageInfo.h" | 14 #include "SkImageInfo.h" |
| 15 | 15 |
| 16 class SkScanlineDecoder : public SkNoncopyable { | 16 class SkScanlineDecoder : public SkNoncopyable { |
| 17 public: | 17 public: |
| 18 /** | 18 /** |
| 19 * Clean up after reading/skipping scanlines. | 19 * Clean up after reading/skipping scanlines. |
| 20 * | 20 * |
| 21 * It is possible that not all scanlines will have been read/skipped. In | 21 * It is possible that not all scanlines will have been read/skipped. In |
| 22 * fact, in the case of subset decodes, it is likely that there will be | 22 * fact, in the case of subset decodes, it is likely that there will be |
| 23 * scanlines at the bottom of the image that have been ignored. | 23 * scanlines at the bottom of the image that have been ignored. |
| 24 * | |
| 25 * Note for implementations: An SkScanlineDecoder will be deleted by (and | |
| 26 * therefore *before*) its associated SkCodec, in case the order matters. | |
| 27 * However, while the SkCodec base class maintains ownership of the | |
| 28 * SkScanlineDecoder, the subclass will be deleted before the scanline | |
| 29 * decoder. If this is an issue, detachScanlineDecoder() provides | |
| 30 * a means for the subclass to take ownership of the SkScanlineDecoder. | |
| 31 */ | 24 */ |
| 32 virtual ~SkScanlineDecoder() {} | 25 virtual ~SkScanlineDecoder() {} |
| 33 | 26 |
| 34 /** | 27 /** |
| 35 * Write the next countLines scanlines into dst. | 28 * Write the next countLines scanlines into dst. |
| 36 * | 29 * |
| 37 * @param dst Must be non-null, and large enough to hold countLines | 30 * @param dst Must be non-null, and large enough to hold countLines |
| 38 * scanlines of size rowBytes. | 31 * scanlines of size rowBytes. |
| 39 * @param countLines Number of lines to write. | 32 * @param countLines Number of lines to write. |
| 40 * @param rowBytes Number of bytes per row. Must be large enough to hold | 33 * @param rowBytes Number of bytes per row. Must be large enough to hold |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Calling the virtual method also means we do not double count | 97 // Calling the virtual method also means we do not double count |
| 105 // countLines. | 98 // countLines. |
| 106 return this->onGetScanlines(storage.get(), countLines, 0); | 99 return this->onGetScanlines(storage.get(), countLines, 0); |
| 107 } | 100 } |
| 108 | 101 |
| 109 virtual SkCodec::Result onGetScanlines(void* dst, int countLines, | 102 virtual SkCodec::Result onGetScanlines(void* dst, int countLines, |
| 110 size_t rowBytes) = 0; | 103 size_t rowBytes) = 0; |
| 111 | 104 |
| 112 }; | 105 }; |
| 113 #endif // SkScanlineDecoder_DEFINED | 106 #endif // SkScanlineDecoder_DEFINED |
| OLD | NEW |