icecat: add release icecat-140.7.0-1gnu1 for ecne
This commit is contained in:
parent
7d0f5dab3b
commit
30225f2e73
156 changed files with 9131 additions and 4525 deletions
|
|
@ -199,6 +199,7 @@ static void ReleaseData(void* aData) {
|
|||
}
|
||||
|
||||
static cairo_surface_t* CopyToImageSurface(unsigned char* aData,
|
||||
const IntSize& aSize,
|
||||
const IntRect& aRect,
|
||||
int32_t aStride,
|
||||
SurfaceFormat aFormat) {
|
||||
|
|
@ -219,15 +220,23 @@ static cairo_surface_t* CopyToImageSurface(unsigned char* aData,
|
|||
}
|
||||
|
||||
unsigned char* surfData = cairo_image_surface_get_data(surf);
|
||||
int surfStride = cairo_image_surface_get_stride(surf);
|
||||
int32_t pixelWidth = BytesPerPixel(aFormat);
|
||||
size_t surfStride = cairo_image_surface_get_stride(surf);
|
||||
size_t pixelWidth = BytesPerPixel(aFormat);
|
||||
size_t rowDataWidth = size_t(aRectWidth) * pixelWidth;
|
||||
if (rowDataWidth > surfStride || rowDataWidth > size_t(aStride) ||
|
||||
!IntRect(IntPoint(), aSize).Contains(aRect)) {
|
||||
cairo_surface_destroy(surf);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned char* source = aData + aRect.Y() * aStride + aRect.X() * pixelWidth;
|
||||
const unsigned char* sourceRow = aData + size_t(aRect.Y()) * size_t(aStride) +
|
||||
size_t(aRect.X()) * pixelWidth;
|
||||
unsigned char* destRow = surfData;
|
||||
|
||||
MOZ_ASSERT(aStride >= aRectWidth * pixelWidth);
|
||||
for (int32_t y = 0; y < aRectHeight; ++y) {
|
||||
memcpy(surfData + y * surfStride, source + y * aStride,
|
||||
aRectWidth * pixelWidth);
|
||||
memcpy(destRow, sourceRow, rowDataWidth);
|
||||
sourceRow += aStride;
|
||||
destRow += surfStride;
|
||||
}
|
||||
cairo_surface_mark_dirty(surf);
|
||||
return surf;
|
||||
|
|
@ -251,14 +260,15 @@ static cairo_surface_t* GetAsImageSurface(cairo_surface_t* aSurface) {
|
|||
}
|
||||
|
||||
static cairo_surface_t* CreateSubImageForData(unsigned char* aData,
|
||||
const IntSize& aSize,
|
||||
const IntRect& aRect, int aStride,
|
||||
SurfaceFormat aFormat) {
|
||||
if (!aData) {
|
||||
if (!aData || aStride < 0 || !IntRect(IntPoint(), aSize).Contains(aRect)) {
|
||||
gfxWarning() << "DrawTargetCairo.CreateSubImageForData null aData";
|
||||
return nullptr;
|
||||
}
|
||||
unsigned char* data =
|
||||
aData + aRect.Y() * aStride + aRect.X() * BytesPerPixel(aFormat);
|
||||
unsigned char* data = aData + size_t(aRect.Y()) * size_t(aStride) +
|
||||
size_t(aRect.X()) * size_t(BytesPerPixel(aFormat));
|
||||
|
||||
cairo_surface_t* image = cairo_image_surface_create_for_data(
|
||||
data, GfxFormatToCairoFormat(aFormat), aRect.Width(), aRect.Height(),
|
||||
|
|
@ -282,9 +292,11 @@ static cairo_surface_t* ExtractSubImage(cairo_surface_t* aSurface,
|
|||
|
||||
cairo_surface_t* image = GetAsImageSurface(aSurface);
|
||||
if (image) {
|
||||
image =
|
||||
CreateSubImageForData(cairo_image_surface_get_data(image), aSubImage,
|
||||
cairo_image_surface_get_stride(image), aFormat);
|
||||
image = CreateSubImageForData(
|
||||
cairo_image_surface_get_data(image),
|
||||
IntSize(cairo_image_surface_get_width(image),
|
||||
cairo_image_surface_get_height(image)),
|
||||
aSubImage, cairo_image_surface_get_stride(image), aFormat);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
|
@ -359,8 +371,8 @@ static cairo_surface_t* GetCairoSurfaceForSourceSurface(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
cairo_surface_t* surf = CreateSubImageForData(map.mData, subimage,
|
||||
map.mStride, data->GetFormat());
|
||||
cairo_surface_t* surf = CreateSubImageForData(
|
||||
map.mData, data->GetSize(), subimage, map.mStride, data->GetFormat());
|
||||
|
||||
// In certain scenarios, requesting larger than 8k image fails. Bug 803568
|
||||
// covers the details of how to run into it, but the full detailed
|
||||
|
|
@ -373,7 +385,7 @@ static cairo_surface_t* GetCairoSurfaceForSourceSurface(
|
|||
// set user data since we're not dependent on the original
|
||||
// data.
|
||||
cairo_surface_t* result = CopyToImageSurface(
|
||||
map.mData, subimage, map.mStride, data->GetFormat());
|
||||
map.mData, data->GetSize(), subimage, map.mStride, data->GetFormat());
|
||||
data->Unmap();
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1862,8 +1874,8 @@ already_AddRefed<SourceSurface> DrawTargetCairo::CreateSourceSurfaceFromData(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
cairo_surface_t* surf =
|
||||
CopyToImageSurface(aData, IntRect(IntPoint(), aSize), aStride, aFormat);
|
||||
cairo_surface_t* surf = CopyToImageSurface(
|
||||
aData, aSize, IntRect(IntPoint(), aSize), aStride, aFormat);
|
||||
if (!surf) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue