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

Side by Side Diff: src/ports/SkImageDecoder_WIC.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 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #include "SkTypes.h" 9 #include "SkTypes.h"
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 bm->eraseColor(SK_ColorTRANSPARENT); 233 bm->eraseColor(SK_ColorTRANSPARENT);
234 const UINT stride = (UINT) bm->rowBytes(); 234 const UINT stride = (UINT) bm->rowBytes();
235 hr = piBitmapSourceConverted->CopyPixels( 235 hr = piBitmapSourceConverted->CopyPixels(
236 NULL, //Get all the pixels 236 NULL, //Get all the pixels
237 stride, 237 stride,
238 stride * height, 238 stride * height,
239 reinterpret_cast<BYTE *>(bm->getPixels()) 239 reinterpret_cast<BYTE *>(bm->getPixels())
240 ); 240 );
241 241
242 // Note: we don't need to premultiply here since we specified PBGRA 242 // Note: we don't need to premultiply here since we specified PBGRA
243 bm->computeAndSetOpaquePredicate(); 243 if (ComputeIsOpaque(*bm)) {
244 bm->setAlphaType(kOpaque_SkAlphaType);
245 }
244 } 246 }
245 247
246 return SUCCEEDED(hr); 248 return SUCCEEDED(hr);
247 } 249 }
248 250
249 ///////////////////////////////////////////////////////////////////////// 251 /////////////////////////////////////////////////////////////////////////
250 252
251 extern SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*); 253 extern SkImageDecoder* image_decoder_from_stream(SkStreamRewindable*);
252 254
253 SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) { 255 SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable* stream) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 static SkImageDecoder::Format get_format_wic(SkStreamRewindable* stream) { 455 static SkImageDecoder::Format get_format_wic(SkStreamRewindable* stream) {
454 SkImageDecoder::Format format; 456 SkImageDecoder::Format format;
455 SkImageDecoder_WIC codec; 457 SkImageDecoder_WIC codec;
456 if (!codec.decodeStream(stream, NULL, SkImageDecoder_WIC::kDecodeFormat_WICM ode, &format)) { 458 if (!codec.decodeStream(stream, NULL, SkImageDecoder_WIC::kDecodeFormat_WICM ode, &format)) {
457 format = SkImageDecoder::kUnknown_Format; 459 format = SkImageDecoder::kUnknown_Format;
458 } 460 }
459 return format; 461 return format;
460 } 462 }
461 463
462 static SkImageDecoder_FormatReg gFormatReg(get_format_wic); 464 static SkImageDecoder_FormatReg gFormatReg(get_format_wic);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698