Make WIC encoder lock the bitmap pixels.

http://codereview.appspot.com/4832045/



git-svn-id: http://skia.googlecode.com/svn/trunk@2016 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bungeman@google.com 2011-08-01 20:18:45 +00:00
parent 22b4950f60
commit 955bb0751a

View File

@ -121,7 +121,7 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
//Copy the pixels into the bitmap.
if (SUCCEEDED(hr)) {
bm->lockPixels();
SkAutoLockPixels alp(*bm);
bm->eraseColor(0);
const int stride = bm->rowBytes();
hr = piBitmapSourceConverted->CopyPixels(
@ -130,7 +130,6 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
stride * height,
reinterpret_cast<BYTE *>(bm->getPixels())
);
bm->unlockPixels();
}
return SUCCEEDED(hr);
@ -268,6 +267,7 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
//Write the pixels into the frame.
if (SUCCEEDED(hr)) {
SkAutoLockPixels alp(*bitmap);
hr = piBitmapFrameEncode->WritePixels(
height
, bitmap->rowBytes()