Bug 826093 (Part 3) - Use ClippedImage instead of ExtractFrame for -moz-image-rect. r=bz

This commit is contained in:
Seth Fowler 2013-03-26 11:56:46 -07:00
Родитель f779875387
Коммит 3a6ac25d8d
1 изменённых файлов: 3 добавлений и 12 удалений

Просмотреть файл

@ -30,6 +30,7 @@
#include "nsIScrollableFrame.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "ImageOps.h"
#include "nsCSSRendering.h"
#include "nsCSSColorUtils.h"
#include "nsITheme.h"
@ -60,6 +61,7 @@
using namespace mozilla;
using namespace mozilla::css;
using mozilla::image::ImageOps;
static int gFrameTreeLockCount = 0;
@ -4293,18 +4295,7 @@ nsImageRenderer::PrepareImage()
// The cropped image is identical to the source image
mImageContainer.swap(srcImage);
} else {
nsCOMPtr<imgIContainer> subImage;
uint32_t aExtractFlags = (mFlags & FLAG_SYNC_DECODE_IMAGES)
? (uint32_t) imgIContainer::FLAG_SYNC_DECODE
: (uint32_t) imgIContainer::FLAG_NONE;
nsresult rv = srcImage->ExtractFrame(imgIContainer::FRAME_CURRENT,
actualCropRect, aExtractFlags,
getter_AddRefs(subImage));
if (NS_FAILED(rv)) {
NS_WARNING("The cropped image contains no pixels to draw; "
"maybe the crop rect is outside the image frame rect");
return false;
}
nsCOMPtr<imgIContainer> subImage = ImageOps::Clip(srcImage, actualCropRect);
mImageContainer.swap(subImage);
}
}