mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 970327 - Add PNG dump utils for SourceSurface. r=nical
This commit is contained in:
parent
2b722685f9
commit
ef197a24c4
@ -885,6 +885,46 @@ gfxUtils::CopyAsDataURL(DrawTarget* aDT)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */ void
|
||||||
|
gfxUtils::WriteAsPNG(RefPtr<gfx::SourceSurface> aSourceSurface, const char* aFile)
|
||||||
|
{
|
||||||
|
RefPtr<gfx::DataSourceSurface> dataSurface = aSourceSurface->GetDataSurface();
|
||||||
|
RefPtr<gfx::DrawTarget> dt
|
||||||
|
= gfxPlatform::GetPlatform()
|
||||||
|
->CreateDrawTargetForData(dataSurface->GetData(),
|
||||||
|
dataSurface->GetSize(),
|
||||||
|
dataSurface->Stride(),
|
||||||
|
aSourceSurface->GetFormat());
|
||||||
|
gfxUtils::WriteAsPNG(dt.get(), aFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ void
|
||||||
|
gfxUtils::DumpAsDataURL(RefPtr<gfx::SourceSurface> aSourceSurface)
|
||||||
|
{
|
||||||
|
RefPtr<gfx::DataSourceSurface> dataSurface = aSourceSurface->GetDataSurface();
|
||||||
|
RefPtr<gfx::DrawTarget> dt
|
||||||
|
= gfxPlatform::GetPlatform()
|
||||||
|
->CreateDrawTargetForData(dataSurface->GetData(),
|
||||||
|
dataSurface->GetSize(),
|
||||||
|
dataSurface->Stride(),
|
||||||
|
aSourceSurface->GetFormat());
|
||||||
|
gfxUtils::DumpAsDataURL(dt.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */ void
|
||||||
|
gfxUtils::CopyAsDataURL(RefPtr<gfx::SourceSurface> aSourceSurface)
|
||||||
|
{
|
||||||
|
RefPtr<gfx::DataSourceSurface> dataSurface = aSourceSurface->GetDataSurface();
|
||||||
|
RefPtr<gfx::DrawTarget> dt
|
||||||
|
= gfxPlatform::GetPlatform()
|
||||||
|
->CreateDrawTargetForData(dataSurface->GetData(),
|
||||||
|
dataSurface->GetSize(),
|
||||||
|
dataSurface->Stride(),
|
||||||
|
aSourceSurface->GetFormat());
|
||||||
|
|
||||||
|
gfxUtils::CopyAsDataURL(dt.get());
|
||||||
|
}
|
||||||
|
|
||||||
bool gfxUtils::sDumpPaintList = getenv("MOZ_DUMP_PAINT_LIST") != 0;
|
bool gfxUtils::sDumpPaintList = getenv("MOZ_DUMP_PAINT_LIST") != 0;
|
||||||
bool gfxUtils::sDumpPainting = getenv("MOZ_DUMP_PAINT") != 0;
|
bool gfxUtils::sDumpPainting = getenv("MOZ_DUMP_PAINT") != 0;
|
||||||
bool gfxUtils::sDumpPaintingToFile = getenv("MOZ_DUMP_PAINT_TO_FILE") != 0;
|
bool gfxUtils::sDumpPaintingToFile = getenv("MOZ_DUMP_PAINT_TO_FILE") != 0;
|
||||||
|
@ -177,6 +177,24 @@ public:
|
|||||||
static bool sDumpPainting;
|
static bool sDumpPainting;
|
||||||
static bool sDumpPaintingToFile;
|
static bool sDumpPaintingToFile;
|
||||||
static FILE* sDumpPaintFile;
|
static FILE* sDumpPaintFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a binary PNG file.
|
||||||
|
* Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads
|
||||||
|
*/
|
||||||
|
static void WriteAsPNG(mozilla::RefPtr<mozilla::gfx::SourceSurface> aSourceSurface, const char* aFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write as a PNG encoded Data URL to stdout.
|
||||||
|
* Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads
|
||||||
|
*/
|
||||||
|
static void DumpAsDataURL(mozilla::RefPtr<mozilla::gfx::SourceSurface> aSourceSurface);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy a PNG encoded Data URL to the clipboard.
|
||||||
|
* Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads
|
||||||
|
*/
|
||||||
|
static void CopyAsDataURL(mozilla::RefPtr<mozilla::gfx::SourceSurface> aSourceSurface);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user