mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 719628 - Fix the formatting and naming of ThebesSurfaceKey. r=mattwoodrow
--HG-- extra : rebase_source : 371e80f924bc6f8dd3dbeea02999ebe8fdd7d27e
This commit is contained in:
parent
fcbcf9f7e7
commit
efcc3eb0ef
@ -529,24 +529,25 @@ cairo_user_data_key_t kDrawSourceSurface;
|
||||
static void
|
||||
DataSourceSurfaceDestroy(void *dataSourceSurface)
|
||||
{
|
||||
static_cast<DataSourceSurface*>(dataSourceSurface)->Release();
|
||||
static_cast<DataSourceSurface*>(dataSourceSurface)->Release();
|
||||
}
|
||||
|
||||
void DestroyThebesSurface(void *data)
|
||||
UserDataKey kThebesSurfaceKey;
|
||||
void
|
||||
DestroyThebesSurface(void *data)
|
||||
{
|
||||
gfxASurface *surface = static_cast<gfxASurface*>(data);
|
||||
surface->Release();
|
||||
}
|
||||
|
||||
UserDataKey ThebesSurfaceKey;
|
||||
|
||||
// The semantics of this function are sort of weird. We snapshot the first
|
||||
// time and then return the snapshotted surface for the lifetime of the
|
||||
// draw target
|
||||
already_AddRefed<gfxASurface>
|
||||
gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
||||
{
|
||||
void *surface = aTarget->GetUserData(&ThebesSurfaceKey);
|
||||
// If we have already created a thebes surface, we can just return it.
|
||||
void *surface = aTarget->GetUserData(&kThebesSurfaceKey);
|
||||
if (surface) {
|
||||
nsRefPtr<gfxASurface> surf = static_cast<gfxASurface*>(surface);
|
||||
return surf.forget();
|
||||
@ -571,7 +572,7 @@ gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
||||
// add a reference to be held by the drawTarget
|
||||
// careful, the reference graph is getting complicated here
|
||||
surf->AddRef();
|
||||
aTarget->AddUserData(&ThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
||||
aTarget->AddUserData(&kThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
||||
|
||||
return surf.forget();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class gfxTextRun;
|
||||
class nsIURI;
|
||||
class nsIAtom;
|
||||
|
||||
extern mozilla::gfx::UserDataKey ThebesSurfaceKey;
|
||||
extern mozilla::gfx::UserDataKey kThebesSurfaceKey;
|
||||
void DestroyThebesSurface(void *data);
|
||||
|
||||
extern cairo_user_data_key_t kDrawTarget;
|
||||
|
@ -303,7 +303,7 @@ already_AddRefed<gfxASurface>
|
||||
gfxPlatformMac::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
||||
{
|
||||
if (aTarget->GetType() == BACKEND_COREGRAPHICS) {
|
||||
void *surface = aTarget->GetUserData(&ThebesSurfaceKey);
|
||||
void *surface = aTarget->GetUserData(&kThebesSurfaceKey);
|
||||
if (surface) {
|
||||
nsRefPtr<gfxASurface> surf = static_cast<gfxQuartzSurface*>(surface);
|
||||
return surf.forget();
|
||||
@ -319,7 +319,7 @@ gfxPlatformMac::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
||||
|
||||
// add a reference to be held by the drawTarget
|
||||
surf->AddRef();
|
||||
aTarget->AddUserData(&ThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
||||
aTarget->AddUserData(&kThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
||||
|
||||
return surf.forget();
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
if (aTarget->GetType() == BACKEND_DIRECT2D) {
|
||||
void *surface = aTarget->GetUserData(&ThebesSurfaceKey);
|
||||
void *surface = aTarget->GetUserData(&kThebesSurfaceKey);
|
||||
if (surface) {
|
||||
nsRefPtr<gfxASurface> surf = static_cast<gfxASurface*>(surface);
|
||||
return surf.forget();
|
||||
@ -526,7 +526,7 @@ gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
||||
|
||||
// add a reference to be held by the drawTarget
|
||||
surf->AddRef();
|
||||
aTarget->AddUserData(&ThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
||||
aTarget->AddUserData(&kThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
||||
/* "It might be worth it to clear cairo surfaces associated with a drawtarget.
|
||||
The strong reference means for example for D2D that cairo's scratch surface
|
||||
will be kept alive (well after a user being done) and consume extra VRAM.
|
||||
|
Loading…
Reference in New Issue
Block a user