icecat: add release icecat-140.9.0-1gnu1 for ecne
This commit is contained in:
parent
8eb1f1732f
commit
a5f93cb214
1197 changed files with 30593 additions and 15344 deletions
|
|
@ -59,6 +59,9 @@ already_AddRefed<GdkPixbuf> nsImageToPixbuf::ImageToPixbuf(
|
|||
|
||||
already_AddRefed<GdkPixbuf> nsImageToPixbuf::SourceSurfaceToPixbuf(
|
||||
SourceSurface* aSurface, int32_t aWidth, int32_t aHeight) {
|
||||
using mozilla::gfx::Factory;
|
||||
|
||||
MOZ_ASSERT(aSurface);
|
||||
MOZ_ASSERT(aWidth <= aSurface->GetSize().width &&
|
||||
aHeight <= aSurface->GetSize().height,
|
||||
"Requested rect is bigger than the supplied surface");
|
||||
|
|
@ -72,11 +75,43 @@ already_AddRefed<GdkPixbuf> nsImageToPixbuf::SourceSurfaceToPixbuf(
|
|||
uint32_t destStride = gdk_pixbuf_get_rowstride(pixbuf);
|
||||
guchar* destPixels = gdk_pixbuf_get_pixels(pixbuf);
|
||||
|
||||
RefPtr<DataSourceSurface> dataSurface = aSurface->GetDataSurface();
|
||||
RefPtr<DataSourceSurface> dataSurface;
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (!dataSurface->Map(DataSourceSurface::MapType::READ, &map)) {
|
||||
return nullptr;
|
||||
|
||||
SurfaceFormat sourceFormat = aSurface->GetFormat();
|
||||
if (MOZ_UNLIKELY(sourceFormat != SurfaceFormat::B8G8R8A8 &&
|
||||
sourceFormat != SurfaceFormat::B8G8R8X8)) {
|
||||
dataSurface = Factory::CreateDataSourceSurface(
|
||||
mozilla::gfx::IntSize(aWidth, aHeight), SurfaceFormat::B8G8R8A8);
|
||||
if (NS_WARN_IF(!dataSurface)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!dataSurface->Map(DataSourceSurface::MapType::READ_WRITE, &map)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<mozilla::gfx::DrawTarget> dt = Factory::CreateDrawTargetForData(
|
||||
mozilla::gfx::BackendType::CAIRO, map.mData, dataSurface->GetSize(),
|
||||
map.mStride, dataSurface->GetFormat());
|
||||
if (!dt) {
|
||||
dataSurface->Unmap();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dt->FillRect(
|
||||
mozilla::gfx::Rect(0, 0, aWidth, aHeight),
|
||||
mozilla::gfx::SurfacePattern(aSurface, mozilla::gfx::ExtendMode::CLAMP),
|
||||
mozilla::gfx::DrawOptions(1.0f,
|
||||
mozilla::gfx::CompositionOp::OP_SOURCE));
|
||||
} else {
|
||||
dataSurface = aSurface->GetDataSurface();
|
||||
if (!dataSurface->Map(DataSourceSurface::MapType::READ, &map)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(dataSurface);
|
||||
MOZ_ASSERT(map.mData);
|
||||
|
||||
uint8_t* srcData = map.mData;
|
||||
int32_t srcStride = map.mStride;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue