| 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 #ifndef SkDecodingImageGenerator_DEFINED | 8 #ifndef SkDecodingImageGenerator_DEFINED |
| 9 #define SkDecodingImageGenerator_DEFINED | 9 #define SkDecodingImageGenerator_DEFINED |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 const bool fRequireUnpremul; | 78 const bool fRequireUnpremul; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * These two functions return a SkImageGenerator that calls into | 82 * These two functions return a SkImageGenerator that calls into |
| 83 * SkImageDecoder. They return NULL on failure. | 83 * SkImageDecoder. They return NULL on failure. |
| 84 * | 84 * |
| 85 * The SkData version of this function is preferred. If the stream | 85 * The SkData version of this function is preferred. If the stream |
| 86 * has an underlying SkData (such as a SkMemoryStream) pass that in. | 86 * has an underlying SkData (such as a SkMemoryStream) pass that in. |
| 87 * | 87 * |
| 88 * This object will unref the stream when done or on failure. Since | 88 * This object, if non-NULL, takes ownership of stream and deletes stream |
| 89 * streams have internal state (position), the caller should not pass | 89 * upon deletion. If NULL is returned, stream is deleted immediately. |
| 90 * a shared stream in. Pass either a new duplicated stream in or | |
| 91 * transfer ownership of the stream. This factory asserts | |
| 92 * stream->unique(). | |
| 93 * | |
| 94 * For example: | |
| 95 * SkStreamRewindable* stream; | |
| 96 * ... | |
| 97 * SkImageGenerator* gen | |
| 98 * = SkDecodingImageGenerator::Create( | |
| 99 * stream->duplicate(), SkDecodingImageGenerator::Options()); | |
| 100 * ... | |
| 101 * SkDELETE(gen); | |
| 102 * | 90 * |
| 103 * @param Options (see above) | 91 * @param Options (see above) |
| 104 * | 92 * |
| 105 * @return NULL on failure, a new SkImageGenerator on success. | 93 * @return NULL on failure, a new SkImageGenerator on success. |
| 106 */ | 94 */ |
| 107 SkImageGenerator* Create(SkStreamRewindable* stream, | 95 SkImageGenerator* Create(SkStreamRewindable* stream, |
| 108 const Options& opt); | 96 const Options& opt); |
| 109 | 97 |
| 110 /** | 98 /** |
| 111 * @param data Contains the encoded image data that will be used by | 99 * @param data Contains the encoded image data that will be used by |
| (...skipping 10 matching lines...) Expand all Loading... |
| 122 // SkDecodingImageGenerator::Create( | 110 // SkDecodingImageGenerator::Create( |
| 123 // data, SkDecodingImageGenerator::Options()), dst, NULL); | 111 // data, SkDecodingImageGenerator::Options()), dst, NULL); |
| 124 // } | 112 // } |
| 125 // bool install_stream(SkStreamRewindable* stream, SkBitmap* dst) { | 113 // bool install_stream(SkStreamRewindable* stream, SkBitmap* dst) { |
| 126 // return SkInstallDiscardablePixelRef( | 114 // return SkInstallDiscardablePixelRef( |
| 127 // SkDecodingImageGenerator::Create( | 115 // SkDecodingImageGenerator::Create( |
| 128 // stream, SkDecodingImageGenerator::Options()), dst, NULL); | 116 // stream, SkDecodingImageGenerator::Options()), dst, NULL); |
| 129 // } | 117 // } |
| 130 | 118 |
| 131 #endif // SkDecodingImageGenerator_DEFINED | 119 #endif // SkDecodingImageGenerator_DEFINED |
| OLD | NEW |