mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 629866. Part 1: Create a DIB for a Win32 surface that's similar to a parent surface with alpha, even if the parent surface doesn't have a DIB. r=jrmuizel
--HG-- extra : rebase_source : 95240f4f4f2d7f7fa453a1eb3ca020c1839160c7
This commit is contained in:
parent
90c20af040
commit
ac7b8cc9c4
@ -130,6 +130,43 @@ gfxWindowsSurface::InitWithDC(PRUint32 flags)
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
gfxWindowsSurface::CreateSimilarSurface(gfxContentType aContent,
|
||||
const gfxIntSize& aSize)
|
||||
{
|
||||
if (!mSurface || !mSurfaceValid) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
cairo_surface_t *surface;
|
||||
if (GetContentType() == CONTENT_COLOR_ALPHA) {
|
||||
// When creating a similar surface to a transparent surface, ensure
|
||||
// the new surface uses a DIB. cairo_surface_create_similar won't
|
||||
// use a DIB for a CONTENT_COLOR surface if this surface doesn't
|
||||
// have a DIB (e.g. if we're a transparent window surface). But
|
||||
// we need a DIB to perform well if the new surface is composited into
|
||||
// a surface that's the result of create_similar(CONTENT_COLOR_ALPHA)
|
||||
// (e.g. a backbuffer for the window) --- that new surface *would*
|
||||
// have a DIB.
|
||||
surface =
|
||||
cairo_win32_surface_create_with_dib(cairo_format_t(gfxASurface::FormatFromContent(aContent)),
|
||||
aSize.width, aSize.height);
|
||||
} else {
|
||||
surface =
|
||||
cairo_surface_create_similar(mSurface, cairo_content_t(aContent),
|
||||
aSize.width, aSize.height);
|
||||
}
|
||||
|
||||
if (cairo_surface_status(surface)) {
|
||||
cairo_surface_destroy(surface);
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxASurface> result = Wrap(surface);
|
||||
cairo_surface_destroy(surface);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
gfxWindowsSurface::~gfxWindowsSurface()
|
||||
{
|
||||
if (mOwnsDC) {
|
||||
|
@ -67,6 +67,9 @@ public:
|
||||
|
||||
gfxWindowsSurface(cairo_surface_t *csurf);
|
||||
|
||||
virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
|
||||
const gfxIntSize& aSize);
|
||||
|
||||
void InitWithDC(PRUint32 flags);
|
||||
|
||||
virtual ~gfxWindowsSurface();
|
||||
|
Loading…
Reference in New Issue
Block a user