| 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..778bcd2c544c966b46d48a7031692cdf3291e1eb
|
| --- /dev/null
|
| +++ b/src/codec/SkCodec_libico.h
|
| @@ -0,0 +1,62 @@
|
| +/*
|
| + * 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 embeddedCodecs codecs for the embedded images, takes ownership
|
| + */
|
| + SkIcoCodec(const SkImageInfo& srcInfo,
|
| + SkTArray<SkAutoTDelete<SkCodec>, true>* embeddedCodecs);
|
| +
|
| + SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>>
|
| + fEmbeddedCodecs; // owned
|
| +
|
| + typedef SkCodec INHERITED;
|
| +};
|
|
|