Bug 934842. CopySurface for data source surfaces. r=Bas

This commit is contained in:
Nicholas Cameron 2013-11-08 14:39:34 +13:00
parent 54fb84bbdf
commit 54557b996d
2 changed files with 8 additions and 22 deletions

View File

@ -724,14 +724,19 @@ DrawTargetCairo::CopySurface(SourceSurface *aSurface,
AutoPrepareForDrawing prep(this, mContext);
AutoClearDeviceOffset clear(aSurface);
if (!aSurface || aSurface->GetType() != SURFACE_CAIRO) {
if (!aSurface) {
gfxWarning() << "Unsupported surface type specified";
return;
}
cairo_surface_t* surf = static_cast<SourceSurfaceCairo*>(aSurface)->GetSurface();
cairo_surface_t* surf = GetCairoSurfaceForSourceSurface(aSurface);
if (!surf) {
gfxWarning() << "Unsupported surface type specified";
return;
}
CopySurfaceInternal(surf, aSource, aDest);
cairo_surface_destroy(surf);
}
void

View File

@ -763,26 +763,7 @@ DrawTargetD2D::CopySurface(SourceSurface *aSurface,
mRT->Clear(D2D1::ColorF(0, 0.0f));
mRT->PopAxisAlignedClip();
RefPtr<ID2D1Bitmap> bitmap;
switch (aSurface->GetType()) {
case SURFACE_D2D1_BITMAP:
{
SourceSurfaceD2D *srcSurf = static_cast<SourceSurfaceD2D*>(aSurface);
bitmap = srcSurf->GetBitmap();
}
break;
case SURFACE_D2D1_DRAWTARGET:
{
SourceSurfaceD2DTarget *srcSurf = static_cast<SourceSurfaceD2DTarget*>(aSurface);
bitmap = srcSurf->GetBitmap(mRT);
AddDependencyOnSource(srcSurf);
}
break;
default:
return;
}
RefPtr<ID2D1Bitmap> bitmap = GetBitmapForSurface(aSurface, srcRect);
if (!bitmap) {
return;
}