Chromium Code Reviews| Index: src/codec/SkCodec_libico.h |
| diff --git a/src/codec/SkCodec_libico.h b/src/codec/SkCodec_libico.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e4cf0bb2dde88c4c3a173954fcd83ad8edf0992c |
| --- /dev/null |
| +++ b/src/codec/SkCodec_libico.h |
| @@ -0,0 +1,58 @@ |
| +/* |
| + * Copyright 2015 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#include "SkCodec.h" |
| +#include "SkImageInfo.h" |
| +#include "SkStream.h" |
| +#include "SkTypes.h" |
| + |
| +/* |
| + * This class implements the decoding for bmp images |
| + */ |
| +class SkIcoCodec : public SkCodec { |
| +public: |
| + |
| + /* |
| + * Checks the start of the stream to see if the image is a Ico or Cur |
| + */ |
| + static bool IsIco(SkStream*); |
| + |
| + /* |
| + * Assumes IsIco was called and returned true |
| + * Creates an Ico decoder |
| + * Reads enough of the stream to determine the image format |
| + */ |
| + static SkCodec* NewFromStream(SkStream*); |
| + |
| +protected: |
| + |
| + /* |
| + * Chooses the best dimensions given the desired scale |
| + */ |
| + SkISize onGetScaledDimensions(float desiredScale) const SK_OVERRIDE; |
| + |
| + /* |
| + * Initiates the Ico decode |
| + */ |
| + Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
| + size_t dstRowBytes, const Options&, SkPMColor*, int*) |
| + SK_OVERRIDE; |
| + |
| + SkEncodedFormat onGetEncodedFormat() const SK_OVERRIDE { return kICO_SkEncodedFormat; } |
| + |
| +private: |
| + |
| + /* |
| + * Constructor called by NewFromStream |
| + * @param embeddedCodec codec for the embedded image |
|
scroggo
2015/03/23 20:34:51
Plural.
Takes ownership
msarett
2015/03/24 13:08:37
Done.
|
| + */ |
| + SkIcoCodec(const SkImageInfo& srcInfo, SkTArray<SkAutoTDelete<SkCodec>, true>* embeddedCodecs); |
| + |
| + SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> fEmbeddedCodecs; // owned |
| + |
| + typedef SkCodec INHERITED; |
| +}; |