Backed out changeset 41b5180cf6af DONTBUILD

This commit is contained in:
Bas Schouten 2012-10-08 12:56:00 +02:00
parent 6ed2f53443
commit 44668f09e1

View File

@ -489,22 +489,9 @@ gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aS
cairo_user_data_key_t kSourceSurface;
/**
* Record the backend that was used to construct the SourceSurface.
* When getting the cached SourceSurface for a gfxASurface/DrawTarget pair,
* we check to make sure the DrawTarget's backend matches the backend
* for the cached SourceSurface, and only use it if they match. This
* can avoid expensive and unnecessary readbacks.
*/
struct SourceSurfaceUserData
void SourceBufferDestroy(void *srcBuffer)
{
RefPtr<SourceSurface> mSrcSurface;
BackendType mBackendType;
};
void SourceBufferDestroy(void *srcSurfUD)
{
delete static_cast<SourceSurfaceUserData*>(srcSurfUD);
static_cast<SourceSurface*>(srcBuffer)->Release();
}
void SourceSnapshotDetached(cairo_surface_t *nullSurf)
@ -521,10 +508,10 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
void *userData = aSurface->GetData(&kSourceSurface);
if (userData) {
SourceSurfaceUserData *surf = static_cast<SourceSurfaceUserData*>(userData);
SourceSurface *surf = static_cast<SourceSurface*>(userData);
if (surf->mSrcSurface->IsValid() && surf->mBackendType == aTarget->GetType()) {
return surf->mSrcSurface;
if (surf->IsValid()) {
return surf;
}
// We can just continue here as when setting new user data the destroy
// function will be called for the old user data.
@ -637,11 +624,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
}
srcBuffer->AddRef();
SourceSurfaceUserData *srcSurfUD = new SourceSurfaceUserData;
srcSurfUD->mBackendType = aTarget->GetType();
srcSurfUD->mSrcSurface = srcBuffer;
aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy);
aSurface->SetData(&kSourceSurface, srcBuffer, SourceBufferDestroy);
return srcBuffer;
}