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
@ -532,21 +532,22 @@ 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);
|
gfxASurface *surface = static_cast<gfxASurface*>(data);
|
||||||
surface->Release();
|
surface->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
UserDataKey ThebesSurfaceKey;
|
|
||||||
|
|
||||||
// The semantics of this function are sort of weird. We snapshot the first
|
// 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
|
// time and then return the snapshotted surface for the lifetime of the
|
||||||
// draw target
|
// draw target
|
||||||
already_AddRefed<gfxASurface>
|
already_AddRefed<gfxASurface>
|
||||||
gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
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) {
|
if (surface) {
|
||||||
nsRefPtr<gfxASurface> surf = static_cast<gfxASurface*>(surface);
|
nsRefPtr<gfxASurface> surf = static_cast<gfxASurface*>(surface);
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
@ -571,7 +572,7 @@ gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|||||||
// add a reference to be held by the drawTarget
|
// add a reference to be held by the drawTarget
|
||||||
// careful, the reference graph is getting complicated here
|
// careful, the reference graph is getting complicated here
|
||||||
surf->AddRef();
|
surf->AddRef();
|
||||||
aTarget->AddUserData(&ThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
aTarget->AddUserData(&kThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
||||||
|
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ class gfxTextRun;
|
|||||||
class nsIURI;
|
class nsIURI;
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
|
|
||||||
extern mozilla::gfx::UserDataKey ThebesSurfaceKey;
|
extern mozilla::gfx::UserDataKey kThebesSurfaceKey;
|
||||||
void DestroyThebesSurface(void *data);
|
void DestroyThebesSurface(void *data);
|
||||||
|
|
||||||
extern cairo_user_data_key_t kDrawTarget;
|
extern cairo_user_data_key_t kDrawTarget;
|
||||||
|
@ -303,7 +303,7 @@ already_AddRefed<gfxASurface>
|
|||||||
gfxPlatformMac::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
gfxPlatformMac::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
||||||
{
|
{
|
||||||
if (aTarget->GetType() == BACKEND_COREGRAPHICS) {
|
if (aTarget->GetType() == BACKEND_COREGRAPHICS) {
|
||||||
void *surface = aTarget->GetUserData(&ThebesSurfaceKey);
|
void *surface = aTarget->GetUserData(&kThebesSurfaceKey);
|
||||||
if (surface) {
|
if (surface) {
|
||||||
nsRefPtr<gfxASurface> surf = static_cast<gfxQuartzSurface*>(surface);
|
nsRefPtr<gfxASurface> surf = static_cast<gfxQuartzSurface*>(surface);
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
@ -319,7 +319,7 @@ gfxPlatformMac::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|||||||
|
|
||||||
// add a reference to be held by the drawTarget
|
// add a reference to be held by the drawTarget
|
||||||
surf->AddRef();
|
surf->AddRef();
|
||||||
aTarget->AddUserData(&ThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
aTarget->AddUserData(&kThebesSurfaceKey, surf.get(), DestroyThebesSurface);
|
||||||
|
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|||||||
{
|
{
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
if (aTarget->GetType() == BACKEND_DIRECT2D) {
|
if (aTarget->GetType() == BACKEND_DIRECT2D) {
|
||||||
void *surface = aTarget->GetUserData(&ThebesSurfaceKey);
|
void *surface = aTarget->GetUserData(&kThebesSurfaceKey);
|
||||||
if (surface) {
|
if (surface) {
|
||||||
nsRefPtr<gfxASurface> surf = static_cast<gfxASurface*>(surface);
|
nsRefPtr<gfxASurface> surf = static_cast<gfxASurface*>(surface);
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
@ -526,7 +526,7 @@ gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|||||||
|
|
||||||
// add a reference to be held by the drawTarget
|
// add a reference to be held by the drawTarget
|
||||||
surf->AddRef();
|
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.
|
/* "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
|
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.
|
will be kept alive (well after a user being done) and consume extra VRAM.
|
||||||
|
Loading…
Reference in New Issue
Block a user