Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: src/codec/SkBmpStandardCodec.h

Issue 1258863008: Split SkBmpCodec into three separate classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/codec/SkBmpRLECodec.cpp ('k') | src/codec/SkBmpStandardCodec.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkBmpCodec.h"
9 #include "SkColorTable.h"
10 #include "SkImageInfo.h"
11 #include "SkSwizzler.h"
12 #include "SkTypes.h"
13
14 /*
15 * This class implements the decoding for bmp images that use "standard" modes,
16 * which essentially means they do not contain bit masks or RLE codes.
17 */
18 class SkBmpStandardCodec : public SkBmpCodec {
19 public:
20
21 /*
22 * Creates an instance of the decoder
23 *
24 * Called only by SkBmpCodec::NewFromStream
25 * There should be no other callers despite this being public
26 *
27 * @param srcInfo contains the source width and height
28 * @param stream the stream of encoded image data
29 * @param bitsPerPixel the number of bits used to store each pixel
30 * @param format the format of the bmp file
31 * @param numColors the number of colors in the color table
32 * @param bytesPerColor the number of bytes in the stream used to represent
33 each color in the color table
34 * @param offset the offset of the image pixel data from the end of the
35 * headers
36 * @param rowOrder indicates whether rows are ordered top-down or bottom-up
37 */
38 SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream,
39 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor ,
40 uint32_t offset, SkBmpCodec::RowOrder rowOrder, bool isIco);
41
42 protected:
43
44 Result onGetPixels(const SkImageInfo& dstInfo, void* dst,
45 size_t dstRowBytes, const Options&, SkPMColor*,
46 int*) override;
47
48 private:
49
50 /*
51 * Creates the color table
52 * Sets colorCount to the new color count if it is non-NULL
53 */
54 bool createColorTable(SkAlphaType alphaType, int* colorCount);
55
56 bool initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts);
57
58 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, con st Options& opts);
59
60 SkAutoTUnref<SkColorTable> fColorTable; // owned
61 const uint32_t fNumColors;
62 const uint32_t fBytesPerColor;
63 const uint32_t fOffset;
64 SkAutoTDelete<SkSwizzler> fSwizzler;
65 SkAutoTDeleteArray<uint8_t> fSrcBuffer;
66 const bool fInIco;
67
68 typedef SkBmpCodec INHERITED;
69 };
OLDNEW
« no previous file with comments | « src/codec/SkBmpRLECodec.cpp ('k') | src/codec/SkBmpStandardCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698