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

Side by Side Diff: src/images/SkImageDecoder_wbmp.cpp

Issue 377443007: fix WBMP image will get null color table when draw in RGB565 Canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 int height = head.fHeight; 112 int height = head.fHeight;
113 113
114 decodedBitmap->setInfo(SkImageInfo::Make(width, height, 114 decodedBitmap->setInfo(SkImageInfo::Make(width, height,
115 kIndex_8_SkColorType, kOpaque_SkAlp haType)); 115 kIndex_8_SkColorType, kOpaque_SkAlp haType));
116 116
117 if (SkImageDecoder::kDecodeBounds_Mode == mode) { 117 if (SkImageDecoder::kDecodeBounds_Mode == mode) {
118 return true; 118 return true;
119 } 119 }
120 120
121 const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE }; 121 const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
122 SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2)); 122 SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2, kOpaque_SkAlphaType) );
123 SkAutoUnref aur(ct); 123 SkAutoUnref aur(ct);
124 124
125 if (!this->allocPixelRef(decodedBitmap, ct)) { 125 if (!this->allocPixelRef(decodedBitmap, ct)) {
126 return false; 126 return false;
127 } 127 }
128 128
129 SkAutoLockPixels alp(*decodedBitmap); 129 SkAutoLockPixels alp(*decodedBitmap);
130 130
131 uint8_t* dst = decodedBitmap->getAddr8(0, 0); 131 uint8_t* dst = decodedBitmap->getAddr8(0, 0);
132 // store the 1-bit valuess at the end of our pixels, so we won't stomp 132 // store the 1-bit valuess at the end of our pixels, so we won't stomp
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 static SkImageDecoder::Format get_format_wbmp(SkStreamRewindable* stream) { 164 static SkImageDecoder::Format get_format_wbmp(SkStreamRewindable* stream) {
165 wbmp_head head; 165 wbmp_head head;
166 if (head.init(stream)) { 166 if (head.init(stream)) {
167 return SkImageDecoder::kWBMP_Format; 167 return SkImageDecoder::kWBMP_Format;
168 } 168 }
169 return SkImageDecoder::kUnknown_Format; 169 return SkImageDecoder::kUnknown_Format;
170 } 170 }
171 171
172 static SkImageDecoder_DecodeReg gDReg(sk_wbmp_dfactory); 172 static SkImageDecoder_DecodeReg gDReg(sk_wbmp_dfactory);
173 static SkImageDecoder_FormatReg gFormatReg(get_format_wbmp); 173 static SkImageDecoder_FormatReg gFormatReg(get_format_wbmp);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698