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

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

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments from previous patch sets Created 5 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBmpCodec.h" 8 #include "SkBmpCodec.h"
9 #include "SkColorTable.h" 9 #include "SkColorTable.h"
10 #include "SkImageInfo.h" 10 #include "SkImageInfo.h"
(...skipping 17 matching lines...) Expand all
28 * @param numColors the number of colors in the color table 28 * @param numColors the number of colors in the color table
29 * @param bytesPerColor the number of bytes in the stream used to represent 29 * @param bytesPerColor the number of bytes in the stream used to represent
30 each color in the color table 30 each color in the color table
31 * @param offset the offset of the image pixel data from the end of the 31 * @param offset the offset of the image pixel data from the end of the
32 * headers 32 * headers
33 * @param rowOrder indicates whether rows are ordered top-down or bottom-up 33 * @param rowOrder indicates whether rows are ordered top-down or bottom-up
34 * @param RLEBytes indicates the amount of data left in the stream 34 * @param RLEBytes indicates the amount of data left in the stream
35 * after decoding the headers 35 * after decoding the headers
36 */ 36 */
37 SkBmpRLECodec(const SkImageInfo& srcInfo, SkStream* stream, 37 SkBmpRLECodec(const SkImageInfo& srcInfo, SkStream* stream,
38 uint16_t bitsPerPixel, uint32_t numColors, 38 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor,
39 uint32_t bytesPerColor, uint32_t offset, 39 uint32_t offset, SkBmpCodec::RowOrder rowOrder, size_t RLEBytes);
40 SkBmpCodec::RowOrder rowOrder, size_t RLEBytes);
41 40
42 protected: 41 protected:
43 42
44 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, 43 Result onGetPixels(const SkImageInfo& dstInfo, void* dst,
45 size_t dstRowBytes, const Options&, SkPMColor*, 44 size_t dstRowBytes, const Options&, SkPMColor*,
46 int*) override; 45 int*) override;
47 46
47 SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo,
48 const SkCodec::Options& options, SkPMColor inputColorPtr[],
49 int* inputColorCount) override;
50
48 private: 51 private:
49 52
50 /* 53 /*
51 * Creates the color table 54 * Creates the color table
52 * Sets colorCount to the new color count if it is non-NULL 55 * Sets colorCount to the new color count if it is non-NULL
53 */ 56 */
54 bool createColorTable(int* colorCount); 57 bool createColorTable(int* colorCount);
55 58
56 bool initializeStreamBuffer(); 59 bool initializeStreamBuffer();
57 60
(...skipping 12 matching lines...) Expand all
70 void setPixel(void* dst, size_t dstRowBytes, 73 void setPixel(void* dst, size_t dstRowBytes,
71 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, 74 const SkImageInfo& dstInfo, uint32_t x, uint32_t y,
72 uint8_t index); 75 uint8_t index);
73 /* 76 /*
74 * Set an RLE24 pixel from R, G, B values 77 * Set an RLE24 pixel from R, G, B values
75 */ 78 */
76 void setRGBPixel(void* dst, size_t dstRowBytes, 79 void setRGBPixel(void* dst, size_t dstRowBytes,
77 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, 80 const SkImageInfo& dstInfo, uint32_t x, uint32_t y,
78 uint8_t red, uint8_t green, uint8_t blue); 81 uint8_t red, uint8_t green, uint8_t blue);
79 82
80 /* 83 Result decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes,
81 * Performs the bitmap decoding for RLE input format 84 const Options& opts) override;
82 */
83 Result decode(const SkImageInfo& dstInfo, void* dst,
84 size_t dstRowBytes, const Options& opts);
85 85
86 SkAutoTUnref<SkColorTable> fColorTable; // owned 86 SkAutoTUnref<SkColorTable> fColorTable; // owned
87 const uint32_t fNumColors; 87 const uint32_t fNumColors;
88 const uint32_t fBytesPerColor; 88 const uint32_t fBytesPerColor;
89 const uint32_t fOffset; 89 const uint32_t fOffset;
90 SkAutoTDeleteArray<uint8_t> fStreamBuffer; 90 SkAutoTDeleteArray<uint8_t> fStreamBuffer;
91 size_t fRLEBytes; 91 size_t fRLEBytes;
92 uint32_t fCurrRLEByte; 92 uint32_t fCurrRLEByte;
93 int fSampleX;
93 94
94 typedef SkBmpCodec INHERITED; 95 typedef SkBmpCodec INHERITED;
95 }; 96 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698