Bug 592024 - Don't clear shared D3D9/D2D surfaces in cairo_d2d_create_for_handle because D3D9 and D2D need a lot of synchronization points. Instead, put a clear in DrawRegion, which already has synchronization points. r=jrmuizel a=blocking

This commit is contained in:
Bas Schouten 2010-09-02 15:07:26 -04:00
Родитель a62b4f2613
Коммит 8ae2d33728
3 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -3628,8 +3628,6 @@ cairo_d2d_surface_create_for_handle(cairo_device_t *device, HANDLE handle, cairo
newSurf->rt->CreateSolidColorBrush(D2D1::ColorF(0, 1.0), &newSurf->solidColorBrush);
_d2d_clear_surface(newSurf);
newSurf->device = d2d_device;
cairo_addref_device(device);

Просмотреть файл

@ -70,6 +70,7 @@ UseOpaqueSurface(Layer* aLayer)
ThebesLayerD3D9::ThebesLayerD3D9(LayerManagerD3D9 *aManager)
: ThebesLayer(aManager, NULL)
, LayerD3D9(aManager)
, mD2DSurfaceInitialized(false)
{
mImplData = static_cast<LayerD3D9*>(this);
aManager->deviceManager()->mThebesLayers.AppendElement(this);
@ -289,6 +290,7 @@ ThebesLayerD3D9::DrawRegion(const nsIntRegion &aRegion)
if (mD2DSurface) {
context = new gfxContext(mD2DSurface);
nsIntRegionRectIterator iter(aRegion);
context->Translate(gfxPoint(-visibleRect.x, -visibleRect.y));
context->NewPath();
const nsIntRect *iterRect;
@ -296,11 +298,14 @@ ThebesLayerD3D9::DrawRegion(const nsIntRegion &aRegion)
context->Rectangle(gfxRect(iterRect->x, iterRect->y, iterRect->width, iterRect->height));
}
context->Clip();
if (mD2DSurface->GetContentType() != gfxASurface::CONTENT_COLOR) {
if (!mD2DSurfaceInitialized ||
mD2DSurface->GetContentType() != gfxASurface::CONTENT_COLOR) {
context->SetOperator(gfxContext::OPERATOR_CLEAR);
context->Paint();
context->SetOperator(gfxContext::OPERATOR_OVER);
mD2DSurfaceInitialized = true;
}
LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
cbInfo.Callback(this, context, aRegion, nsIntRegion(), cbInfo.CallbackData);
mD2DSurface->Flush();
@ -423,6 +428,7 @@ ThebesLayerD3D9::CreateNewTexture(const gfxIntSize &aSize)
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), &sharedHandle);
mD2DSurfaceInitialized = false;
mD2DSurface = new gfxD2DSurface(sharedHandle, UseOpaqueSurface(this) ?
gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA);

Просмотреть файл

@ -73,6 +73,8 @@ private:
/* This contains the D2D surface if we have one */
nsRefPtr<gfxASurface> mD2DSurface;
bool mD2DSurfaceInitialized;
/* Have a region of our layer drawn */
void DrawRegion(const nsIntRegion &aRegion);