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 #include "SkTypes.h" | 9 #include "SkTypes.h" |
10 | 10 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if (SUCCEEDED(hr)) { | 224 if (SUCCEEDED(hr)) { |
225 hr = piFormatConverter->QueryInterface( | 225 hr = piFormatConverter->QueryInterface( |
226 IID_PPV_ARGS(&piBitmapSourceConverted) | 226 IID_PPV_ARGS(&piBitmapSourceConverted) |
227 ); | 227 ); |
228 } | 228 } |
229 | 229 |
230 //Copy the pixels into the bitmap. | 230 //Copy the pixels into the bitmap. |
231 if (SUCCEEDED(hr)) { | 231 if (SUCCEEDED(hr)) { |
232 SkAutoLockPixels alp(*bm); | 232 SkAutoLockPixels alp(*bm); |
233 bm->eraseColor(SK_ColorTRANSPARENT); | 233 bm->eraseColor(SK_ColorTRANSPARENT); |
234 const UINT stride = 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 bm->computeAndSetOpaquePredicate(); |
244 } | 244 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 hr = piBitmapFrameEncode->SetPixelFormat(&formatGUID); | 407 hr = piBitmapFrameEncode->SetPixelFormat(&formatGUID); |
408 } | 408 } |
409 if (SUCCEEDED(hr)) { | 409 if (SUCCEEDED(hr)) { |
410 //Be sure the image format is the one requested. | 410 //Be sure the image format is the one requested. |
411 hr = IsEqualGUID(formatGUID, formatDesired) ? S_OK : E_FAIL; | 411 hr = IsEqualGUID(formatGUID, formatDesired) ? S_OK : E_FAIL; |
412 } | 412 } |
413 | 413 |
414 //Write the pixels into the frame. | 414 //Write the pixels into the frame. |
415 if (SUCCEEDED(hr)) { | 415 if (SUCCEEDED(hr)) { |
416 SkAutoLockPixels alp(*bitmap); | 416 SkAutoLockPixels alp(*bitmap); |
417 const UINT stride = bitmap->rowBytes(); | 417 const UINT stride = (UINT) bitmap->rowBytes(); |
418 hr = piBitmapFrameEncode->WritePixels( | 418 hr = piBitmapFrameEncode->WritePixels( |
419 height | 419 height |
420 , stride | 420 , stride |
421 , stride * height | 421 , stride * height |
422 , reinterpret_cast<BYTE*>(bitmap->getPixels())); | 422 , reinterpret_cast<BYTE*>(bitmap->getPixels())); |
423 } | 423 } |
424 | 424 |
425 if (SUCCEEDED(hr)) { | 425 if (SUCCEEDED(hr)) { |
426 hr = piBitmapFrameEncode->Commit(); | 426 hr = piBitmapFrameEncode->Commit(); |
427 } | 427 } |
(...skipping 25 matching lines...) Expand all Loading... |
453 static SkImageDecoder::Format get_format_wic(SkStreamRewindable* stream) { | 453 static SkImageDecoder::Format get_format_wic(SkStreamRewindable* stream) { |
454 SkImageDecoder::Format format; | 454 SkImageDecoder::Format format; |
455 SkImageDecoder_WIC codec; | 455 SkImageDecoder_WIC codec; |
456 if (!codec.decodeStream(stream, NULL, SkImageDecoder_WIC::kDecodeFormat_WICM
ode, &format)) { | 456 if (!codec.decodeStream(stream, NULL, SkImageDecoder_WIC::kDecodeFormat_WICM
ode, &format)) { |
457 format = SkImageDecoder::kUnknown_Format; | 457 format = SkImageDecoder::kUnknown_Format; |
458 } | 458 } |
459 return format; | 459 return format; |
460 } | 460 } |
461 | 461 |
462 static SkImageDecoder_FormatReg gFormatReg(get_format_wic); | 462 static SkImageDecoder_FormatReg gFormatReg(get_format_wic); |
OLD | NEW |