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

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

Issue 25275004: store SkAlphaType inside SkBitmap, on road to support unpremul (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 { 104 {
105 wbmp_head head; 105 wbmp_head head;
106 106
107 if (!head.init(stream)) { 107 if (!head.init(stream)) {
108 return false; 108 return false;
109 } 109 }
110 110
111 int width = head.fWidth; 111 int width = head.fWidth;
112 int height = head.fHeight; 112 int height = head.fHeight;
113 113
114 decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height); 114 decodedBitmap->setConfig(SkBitmap::kIndex8_Config, width, height, 0,
115 decodedBitmap->setIsOpaque(true); 115 kOpaque_SkAlphaType);
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));
123 SkAutoUnref aur(ct); 123 SkAutoUnref aur(ct);
124 124
125 if (!this->allocPixelRef(decodedBitmap, ct)) { 125 if (!this->allocPixelRef(decodedBitmap, ct)) {
(...skipping 38 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

Powered by Google App Engine
This is Rietveld 408576698