Bug 886173 - Preserve playbackRate across pause/play. r=cpearce
[gecko.git] / image / decoders / nsIconDecoder.h
blob31bf2e0f88bc4606ae3a47d305a2dd3d04d2393f
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsIconDecoder_h__
8 #define nsIconDecoder_h__
10 #include "Decoder.h"
12 #include "nsCOMPtr.h"
14 namespace mozilla {
15 namespace image {
16 class RasterImage;
18 //////////////////////////////////////////////////////////////////////////////////////////////
19 // The icon decoder is a decoder specifically tailored for loading icons
20 // from the OS. We've defined our own little format to represent these icons
21 // and this decoder takes that format and converts it into 24-bit RGB with alpha channel
22 // support. It was modeled a bit off the PPM decoder.
24 // Assumptions about the decoder:
25 // (1) We receive ALL of the data from the icon channel in one OnDataAvailable call. We don't
26 // support multiple ODA calls yet.
27 // (2) the format of the incoming data is as follows:
28 // The first two bytes contain the width and the height of the icon.
29 // The remaining bytes contain the icon data, 4 bytes per pixel, in
30 // ARGB order (platform endianness, A in highest bits, B in lowest
31 // bits), row-primary, top-to-bottom, left-to-right, with
32 // premultiplied alpha.
35 //////////////////////////////////////////////////////////////////////////////////////////////
37 class nsIconDecoder : public Decoder
39 public:
41 nsIconDecoder(RasterImage &aImage);
42 virtual ~nsIconDecoder();
44 virtual void WriteInternal(const char* aBuffer, uint32_t aCount);
46 uint8_t mWidth;
47 uint8_t mHeight;
48 uint32_t mPixBytesRead;
49 uint32_t mState;
52 enum {
53 iconStateStart = 0,
54 iconStateHaveHeight = 1,
55 iconStateReadPixels = 2,
56 iconStateFinished = 3
59 } // namespace image
60 } // namespace mozilla
62 #endif // nsIconDecoder_h__