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

Side by Side Diff: src/ports/SkImageDecoder_WIC.cpp

Issue 1791583002: Remove uses of SkImageDecoder from gms (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « gm/tiledscaledbitmap.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 hr = piBitmapFrameEncode->Initialize(piPropertybag.get()); 397 hr = piBitmapFrameEncode->Initialize(piPropertybag.get());
398 } 398 }
399 399
400 //Set the size of the frame. 400 //Set the size of the frame.
401 const UINT width = bitmap->width(); 401 const UINT width = bitmap->width();
402 const UINT height = bitmap->height(); 402 const UINT height = bitmap->height();
403 if (SUCCEEDED(hr)) { 403 if (SUCCEEDED(hr)) {
404 hr = piBitmapFrameEncode->SetSize(width, height); 404 hr = piBitmapFrameEncode->SetSize(width, height);
405 } 405 }
406 406
407 //Set the pixel format of the frame. 407 //Set the pixel format of the frame. If native encoded format cannot match BGRA,
408 //it will choose the closest pixel format that it supports.
408 const WICPixelFormatGUID formatDesired = GUID_WICPixelFormat32bppBGRA; 409 const WICPixelFormatGUID formatDesired = GUID_WICPixelFormat32bppBGRA;
409 WICPixelFormatGUID formatGUID = formatDesired; 410 WICPixelFormatGUID formatGUID = formatDesired;
410 if (SUCCEEDED(hr)) { 411 if (SUCCEEDED(hr)) {
411 hr = piBitmapFrameEncode->SetPixelFormat(&formatGUID); 412 hr = piBitmapFrameEncode->SetPixelFormat(&formatGUID);
412 } 413 }
413 if (SUCCEEDED(hr)) {
414 //Be sure the image format is the one requested.
415 hr = IsEqualGUID(formatGUID, formatDesired) ? S_OK : E_FAIL;
416 }
417 414
418 //Write the pixels into the frame. 415 //Write the pixels into the frame.
419 if (SUCCEEDED(hr)) { 416 if (SUCCEEDED(hr)) {
420 SkAutoLockPixels alp(*bitmap); 417 SkAutoLockPixels alp(*bitmap);
421 const UINT stride = (UINT) bitmap->rowBytes(); 418 const UINT stride = (UINT) bitmap->rowBytes();
422 hr = piBitmapFrameEncode->WritePixels( 419 hr = piBitmapFrameEncode->WritePixels(
423 height 420 height
424 , stride 421 , stride
425 , stride * height 422 , stride * height
426 , reinterpret_cast<BYTE*>(bitmap->getPixels())); 423 , reinterpret_cast<BYTE*>(bitmap->getPixels()));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 SkImageDecoder_WIC codec; 456 SkImageDecoder_WIC codec;
460 if (!codec.decodeStream(stream, nullptr, SkImageDecoder_WIC::kDecodeFormat_W ICMode, &format)) { 457 if (!codec.decodeStream(stream, nullptr, SkImageDecoder_WIC::kDecodeFormat_W ICMode, &format)) {
461 format = SkImageDecoder::kUnknown_Format; 458 format = SkImageDecoder::kUnknown_Format;
462 } 459 }
463 return format; 460 return format;
464 } 461 }
465 462
466 static SkImageDecoder_FormatReg gFormatReg(get_format_wic); 463 static SkImageDecoder_FormatReg gFormatReg(get_format_wic);
467 464
468 #endif // defined(SK_BUILD_FOR_WIN32) 465 #endif // defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « gm/tiledscaledbitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698