aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images/SkImageDecoder_wbmp.cpp
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
commitd6176b0dcacb124539e0cfd051e6d93a9782f020 (patch)
tree9e6f4b465e54c9b26e1ba70cd8890b55abb08464 /src/images/SkImageDecoder_wbmp.cpp
parentfbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (diff)
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6474054 git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images/SkImageDecoder_wbmp.cpp')
-rw-r--r--src/images/SkImageDecoder_wbmp.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp
index fedeedbab1..175a444008 100644
--- a/src/images/SkImageDecoder_wbmp.cpp
+++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -20,7 +20,7 @@ public:
virtual Format getFormat() const {
return kWBMP_Format;
}
-
+
protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
};
@@ -40,7 +40,7 @@ static bool read_mbf(SkStream* stream, int* value)
}
n = (n << 7) | (data & 0x7F);
} while (data & 0x80);
-
+
*value = n;
return true;
}
@@ -48,11 +48,11 @@ static bool read_mbf(SkStream* stream, int* value)
struct wbmp_head {
int fWidth;
int fHeight;
-
+
bool init(SkStream* stream)
{
uint8_t data;
-
+
if (!read_byte(stream, &data) || data != 0) { // unknown type
return false;
}
@@ -68,11 +68,11 @@ struct wbmp_head {
return fWidth != 0 && fHeight != 0;
}
};
-
+
static void expand_bits_to_bytes(uint8_t dst[], const uint8_t src[], int bits)
{
int bytes = bits >> 3;
-
+
for (int i = 0; i < bytes; i++) {
unsigned mask = *src++;
dst[0] = (mask >> 7) & 1;
@@ -85,14 +85,14 @@ static void expand_bits_to_bytes(uint8_t dst[], const uint8_t src[], int bits)
dst[7] = (mask >> 0) & 1;
dst += 8;
}
-
+
bits &= 7;
if (bits > 0) {
unsigned mask = *src;
do {
*dst++ = (mask >> 7) & 1;;
mask <<= 1;
- } while (--bits != 0);
+ } while (--bits != 0);
}
}
@@ -100,21 +100,21 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
Mode mode)
{
wbmp_head head;
-
+
if (!head.init(stream)) {
return false;
}
-
+
int width = head.fWidth;
int height = head.fHeight;
-
+
// assign these directly, in case we return kDimensions_Result
decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height);
decodedBitmap->setIsOpaque(true);
-
+
if (SkImageDecoder::kDecodeBounds_Mode == mode)
return true;
-
+
const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2));
SkAutoUnref aur(ct);