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

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

Issue 1321433002: Add subsetting to SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-scan
Patch Set: Created 5 years, 2 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 #ifndef SkBmpCodec_DEFINED 7 #ifndef SkBmpCodec_DEFINED
8 #define SkBmpCodec_DEFINED 8 #define SkBmpCodec_DEFINED
9 9
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 /* 84 /*
85 * Compute the number of colors in the color table 85 * Compute the number of colors in the color table
86 */ 86 */
87 uint32_t computeNumColors(uint32_t numColors); 87 uint32_t computeNumColors(uint32_t numColors);
88 88
89 /* 89 /*
90 * Accessors used by subclasses 90 * Accessors used by subclasses
91 */ 91 */
92 uint16_t bitsPerPixel() const { return fBitsPerPixel; } 92 uint16_t bitsPerPixel() const { return fBitsPerPixel; }
93
94 int subsetLeft() const { return fSubsetLeft; }
95 int subsetWidth() const {return fSubsetWidth; }
msarett 2015/10/02 14:49:15 I need to rename this. This is different from the
96
97 private:
98
93 SkScanlineOrder onGetScanlineOrder() const override { return fRowOrder; } 99 SkScanlineOrder onGetScanlineOrder() const override { return fRowOrder; }
94 100
95 /* 101 /*
96 * To be overriden by bmp subclasses, which provide unique implementations. 102 * To be overriden by bmp subclasses, which provide unique implementations.
97 * Performs subclass specific setup. 103 * Performs subclass specific setup.
98 * 104 *
99 * @param dstInfo Contains output information. Height specifies 105 * @param dstInfo Contains output information. Height specifies
100 * the total number of rows that will be decoded. 106 * the total number of rows that will be decoded.
101 * @param options Additonal options to pass to the decoder. 107 * @param options Additonal options to pass to the decoder.
102 * @param inputColorPtr Client-provided memory for a color table. Must 108 * @param inputColorPtr Client-provided memory for a color table. Must
103 * be enough for 256 colors. This will be 109 * be enough for 256 colors. This will be
104 * populated with colors if the encoded image uses 110 * populated with colors if the encoded image uses
105 * a color table. 111 * a color table.
106 * @param inputColorCount If the encoded image uses a color table, this 112 * @param inputColorCount If the encoded image uses a color table, this
107 * will be set to the number of colors in the 113 * will be set to the number of colors in the
108 * color table. 114 * color table.
109 */ 115 */
110 virtual SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, 116 virtual SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo,
111 const SkCodec::Options& options, SkPMColor inputColorPtr[], 117 const SkCodec::Options& options, SkPMColor inputColorPtr[],
112 int* inputColorCount) = 0; 118 int* inputColorCount) = 0;
113 119
114 private:
115
116 /* 120 /*
117 * Creates a bmp decoder 121 * Creates a bmp decoder
118 * Reads enough of the stream to determine the image format 122 * Reads enough of the stream to determine the image format
119 */ 123 */
120 static SkCodec* NewFromStream(SkStream*, bool inIco); 124 static SkCodec* NewFromStream(SkStream*, bool inIco);
121 125
122 /* 126 /*
123 * Decodes the next dstInfo.height() lines. 127 * Decodes the next dstInfo.height() lines.
124 * 128 *
125 * onGetPixels() uses this for full image decodes. 129 * onGetPixels() uses this for full image decodes.
126 * SkScaledCodec::onGetPixels() uses the scanline decoder to call this with 130 * SkScaledCodec::onGetPixels() uses the scanline decoder to call this with
127 * dstInfo.height() = 1, in order to implement sampling. 131 * dstInfo.height() = 1, in order to implement sampling.
128 * A potential future use is to allow the caller to decode a subset of the 132 * A potential future use is to allow the caller to decode a subset of the
129 * lines in the image. 133 * lines in the image.
130 * 134 *
131 * @param dstInfo Contains output information. Height specifies the 135 * @param dstInfo Contains output information. Height specifies the
132 * number of rows to decode at this time. 136 * number of rows to decode at this time.
133 * @param dst Memory location to store output pixels 137 * @param dst Memory location to store output pixels
134 * @param dstRowBytes Bytes in a row of the destination 138 * @param dstRowBytes Bytes in a row of the destination
135 * @return Number of rows successfully decoded 139 * @return Number of rows successfully decoded
136 */ 140 */
137 virtual int decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowB ytes, 141 virtual int decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowB ytes,
138 const Options& opts) = 0; 142 const Options& opts) = 0;
139 143
140 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Opti ons&, 144 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const SkCodec::Opti ons&,
141 SkPMColor inputColorPtr[], int* inputColorCount) override; 145 SkPMColor inputColorPtr[], int* inputColorCount, int subsetLeft, int subsetWidth)
146 override;
142 147
143 int onGetScanlines(void* dst, int count, size_t rowBytes) override; 148 int onGetScanlines(void* dst, int count, size_t rowBytes) override;
144 149
145 // TODO(msarett): Override default skipping with something more clever. 150 // TODO(msarett): Override default skipping with something more clever.
146 151
147 const uint16_t fBitsPerPixel; 152 const uint16_t fBitsPerPixel;
153 int fSubsetLeft;
154 int fSubsetWidth;
148 const SkScanlineOrder fRowOrder; 155 const SkScanlineOrder fRowOrder;
149 156
150 typedef SkCodec INHERITED; 157 typedef SkCodec INHERITED;
151 }; 158 };
152 159
153 #endif 160 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698