| OLD | NEW |
| 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 | 9 |
| 10 #define WIN32_LEAN_AND_MEAN | 10 #define WIN32_LEAN_AND_MEAN |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return false; | 176 return false; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 //Create a format converter. | 180 //Create a format converter. |
| 181 SkTScopedComPtr<IWICFormatConverter> piFormatConverter; | 181 SkTScopedComPtr<IWICFormatConverter> piFormatConverter; |
| 182 if (SUCCEEDED(hr)) { | 182 if (SUCCEEDED(hr)) { |
| 183 hr = piImagingFactory->CreateFormatConverter(&piFormatConverter); | 183 hr = piImagingFactory->CreateFormatConverter(&piFormatConverter); |
| 184 } | 184 } |
| 185 | 185 |
| 186 GUID destinationPixelFormat; |
| 187 if (this->getRequireUnpremultipliedColors()) { |
| 188 destinationPixelFormat = GUID_WICPixelFormat32bppBGRA; |
| 189 } else { |
| 190 destinationPixelFormat = GUID_WICPixelFormat32bppPBGRA; |
| 191 } |
| 192 |
| 186 if (SUCCEEDED(hr)) { | 193 if (SUCCEEDED(hr)) { |
| 187 hr = piFormatConverter->Initialize( | 194 hr = piFormatConverter->Initialize( |
| 188 piBitmapSourceOriginal.get() //Input bitmap to convert | 195 piBitmapSourceOriginal.get() //Input bitmap to convert |
| 189 , GUID_WICPixelFormat32bppPBGRA //Destination pixel format | 196 , destinationPixelFormat //Destination pixel format |
| 190 , WICBitmapDitherTypeNone //Specified dither patterm | 197 , WICBitmapDitherTypeNone //Specified dither patterm |
| 191 , NULL //Specify a particular palette | 198 , NULL //Specify a particular palette |
| 192 , 0.f //Alpha threshold | 199 , 0.f //Alpha threshold |
| 193 , WICBitmapPaletteTypeCustom //Palette translation type | 200 , WICBitmapPaletteTypeCustom //Palette translation type |
| 194 ); | 201 ); |
| 195 } | 202 } |
| 196 | 203 |
| 197 //Get the BitmapSource interface of the format converter. | 204 //Get the BitmapSource interface of the format converter. |
| 198 SkTScopedComPtr<IWICBitmapSource> piBitmapSourceConverted; | 205 SkTScopedComPtr<IWICBitmapSource> piBitmapSourceConverted; |
| 199 if (SUCCEEDED(hr)) { | 206 if (SUCCEEDED(hr)) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 static SkImageDecoder::Format get_format_wic(SkStream* stream) { | 436 static SkImageDecoder::Format get_format_wic(SkStream* stream) { |
| 430 SkImageDecoder::Format format; | 437 SkImageDecoder::Format format; |
| 431 SkImageDecoder_WIC codec; | 438 SkImageDecoder_WIC codec; |
| 432 if (!codec.decodeStream(stream, NULL, SkImageDecoder_WIC::kDecodeFormat_WICM
ode, &format)) { | 439 if (!codec.decodeStream(stream, NULL, SkImageDecoder_WIC::kDecodeFormat_WICM
ode, &format)) { |
| 433 format = SkImageDecoder::kUnknown_Format; | 440 format = SkImageDecoder::kUnknown_Format; |
| 434 } | 441 } |
| 435 return format; | 442 return format; |
| 436 } | 443 } |
| 437 | 444 |
| 438 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_wic)
; | 445 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_wic)
; |
| OLD | NEW |