2 * Copyright 2015 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
9 #include "SkImageInfo.h"
14 * This class implements the decoding for bmp images
16 class SkIcoCodec : public SkCodec {
20 * Checks the start of the stream to see if the image is a Ico or Cur
22 static bool IsIco(SkStream*);
25 * Assumes IsIco was called and returned true
26 * Creates an Ico decoder
27 * Reads enough of the stream to determine the image format
29 static SkCodec* NewFromStream(SkStream*);
34 * Chooses the best dimensions given the desired scale
36 SkISize onGetScaledDimensions(float desiredScale) const SK_OVERRIDE;
39 * Initiates the Ico decode
41 Result onGetPixels(const SkImageInfo& dstInfo, void* dst,
42 size_t dstRowBytes, const Options&, SkPMColor*, int*)
45 SkEncodedFormat onGetEncodedFormat() const SK_OVERRIDE {
46 return kICO_SkEncodedFormat;
52 * Constructor called by NewFromStream
53 * @param embeddedCodecs codecs for the embedded images, takes ownership
55 SkIcoCodec(const SkImageInfo& srcInfo,
56 SkTArray<SkAutoTDelete<SkCodec>, true>* embeddedCodecs);
58 SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>>
59 fEmbeddedCodecs; // owned
61 typedef SkCodec INHERITED;