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

Side by Side Diff: src/images/SkImageDecoder_libbmp.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 2007 The Android Open Source Project 3 * Copyright 2007 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 "bmpdecoderhelper.h" 10 #include "bmpdecoderhelper.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 SkBitmap::Config config = this->getPrefConfig(k32Bit_SrcDepth, false); 126 SkBitmap::Config config = this->getPrefConfig(k32Bit_SrcDepth, false);
127 127
128 // only accept prefConfig if it makes sense for us 128 // only accept prefConfig if it makes sense for us
129 if (SkBitmap::kARGB_4444_Config != config && 129 if (SkBitmap::kARGB_4444_Config != config &&
130 SkBitmap::kRGB_565_Config != config) { 130 SkBitmap::kRGB_565_Config != config) {
131 config = SkBitmap::kARGB_8888_Config; 131 config = SkBitmap::kARGB_8888_Config;
132 } 132 }
133 133
134 SkScaledBitmapSampler sampler(width, height, getSampleSize()); 134 SkScaledBitmapSampler sampler(width, height, getSampleSize());
135 135
136 bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight()); 136 bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight(), 0,
137 bm->setIsOpaque(true); 137 kOpaque_SkAlphaType);
138 138
139 if (justBounds) { 139 if (justBounds) {
140 return true; 140 return true;
141 } 141 }
142 142
143 if (!this->allocPixelRef(bm, NULL)) { 143 if (!this->allocPixelRef(bm, NULL)) {
144 return false; 144 return false;
145 } 145 }
146 146
147 SkAutoLockPixels alp(*bm); 147 SkAutoLockPixels alp(*bm);
148 148
149 if (!sampler.begin(bm, SkScaledBitmapSampler::kRGB, *this)) { 149 if (!sampler.begin(bm, SkScaledBitmapSampler::kRGB, *this)) {
150 return false; 150 return false;
151 } 151 }
152 152
153 const int srcRowBytes = width * 3; 153 const int srcRowBytes = width * 3;
154 const int dstHeight = sampler.scaledHeight(); 154 const int dstHeight = sampler.scaledHeight();
155 const uint8_t* srcRow = callback.rgb(); 155 const uint8_t* srcRow = callback.rgb();
156 156
157 srcRow += sampler.srcY0() * srcRowBytes; 157 srcRow += sampler.srcY0() * srcRowBytes;
158 for (int y = 0; y < dstHeight; y++) { 158 for (int y = 0; y < dstHeight; y++) {
159 sampler.next(srcRow); 159 sampler.next(srcRow);
160 srcRow += sampler.srcDY() * srcRowBytes; 160 srcRow += sampler.srcDY() * srcRowBytes;
161 } 161 }
162 return true; 162 return true;
163 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698