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__
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
41 nsIconDecoder(RasterImage
&aImage
);
42 virtual ~nsIconDecoder();
44 virtual void WriteInternal(const char* aBuffer
, uint32_t aCount
);
48 uint32_t mPixBytesRead
;
54 iconStateHaveHeight
= 1,
55 iconStateReadPixels
= 2,
60 } // namespace mozilla
62 #endif // nsIconDecoder_h__