OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkCodec.h" |
| 9 #include "SkData.h" |
| 10 #include "SkImageGenerator.h" |
| 11 |
| 12 class SkCodecImageGenerator : public SkImageGenerator { |
| 13 public: |
| 14 /* |
| 15 * If this data represents an encoded image that we know how to decode, |
| 16 * return an SkCodecImageGenerator. Otherwise return nullptr. |
| 17 * |
| 18 * Refs the data if an image generator can be returned. Otherwise does |
| 19 * not affect the data. |
| 20 */ |
| 21 static SkImageGenerator* NewFromEncodedCodec(SkData* data); |
| 22 |
| 23 protected: |
| 24 SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override; |
| 25 |
| 26 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkP
MColor ctable[], |
| 27 int* ctableCount) override; |
| 28 |
| 29 bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], |
| 30 SkYUVColorSpace* colorSpace) override; |
| 31 |
| 32 private: |
| 33 /* |
| 34 * Takes ownership of codec |
| 35 * Refs the data |
| 36 */ |
| 37 SkCodecImageGenerator(SkCodec* codec, SkData* data); |
| 38 |
| 39 SkAutoTDelete<SkCodec> fCodec; |
| 40 SkAutoTUnref<SkData> fData; |
| 41 |
| 42 typedef SkImageGenerator INHERITED; |
| 43 }; |
OLD | NEW |