зеркало из https://github.com/mozilla/gecko-dev.git
Bug 951554. Change the high level painting functions. r=nical
--HG-- extra : rebase_source : bcbed6d9d4e46d4b21854954789fe6ba28cdf3cc
This commit is contained in:
Родитель
a62864d887
Коммит
2faa3798f1
|
@ -169,11 +169,6 @@ BasicThebesLayer::Validate(LayerManager::DrawThebesLayerCallback aCallback,
|
|||
return;
|
||||
}
|
||||
|
||||
bool canUseOpaqueSurface = CanUseOpaqueSurface();
|
||||
ContentType contentType =
|
||||
canUseOpaqueSurface ? GFX_CONTENT_COLOR :
|
||||
GFX_CONTENT_COLOR_ALPHA;
|
||||
|
||||
uint32_t flags = 0;
|
||||
#ifndef MOZ_WIDGET_ANDROID
|
||||
if (BasicManager()->CompositorMightResample()) {
|
||||
|
@ -189,31 +184,30 @@ BasicThebesLayer::Validate(LayerManager::DrawThebesLayerCallback aCallback,
|
|||
flags |= RotatedContentBuffer::PAINT_NO_ROTATION;
|
||||
}
|
||||
PaintState state =
|
||||
mContentClient->BeginPaintBuffer(this, contentType, flags);
|
||||
mContentClient->BeginPaintBuffer(this, flags);
|
||||
mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate);
|
||||
|
||||
if (state.mTarget) {
|
||||
if (DrawTarget* target = mContentClient->BorrowDrawTargetForPainting(this, state)) {
|
||||
// The area that became invalid and is visible needs to be repainted
|
||||
// (this could be the whole visible area if our buffer switched
|
||||
// from RGB to RGBA, because we might need to repaint with
|
||||
// subpixel AA)
|
||||
state.mRegionToInvalidate.And(state.mRegionToInvalidate,
|
||||
GetEffectiveVisibleRegion());
|
||||
nsIntRegion extendedDrawRegion = state.mRegionToDraw;
|
||||
SetAntialiasingFlags(this, state.mTarget);
|
||||
SetAntialiasingFlags(this, target);
|
||||
|
||||
RenderTraceInvalidateStart(this, "FFFF00", state.mRegionToDraw.GetBounds());
|
||||
|
||||
nsRefPtr<gfxContext> ctx = gfxContext::ContextForDrawTarget(state.mTarget);
|
||||
nsRefPtr<gfxContext> ctx = gfxContext::ContextForDrawTarget(target);
|
||||
PaintBuffer(ctx,
|
||||
state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate,
|
||||
state.mRegionToDraw, state.mRegionToDraw, state.mRegionToInvalidate,
|
||||
state.mDidSelfCopy,
|
||||
state.mClip,
|
||||
aCallback, aCallbackData);
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this));
|
||||
Mutated();
|
||||
ctx = nullptr;
|
||||
mContentClient->ReturnDrawTarget(state.mTarget);
|
||||
mContentClient->ReturnDrawTarget(target);
|
||||
|
||||
RenderTraceInvalidateEnd(this, "FFFF00");
|
||||
} else {
|
||||
|
|
|
@ -36,17 +36,9 @@ ClientThebesLayer::PaintThebes()
|
|||
NS_ASSERTION(ClientManager()->InDrawing(),
|
||||
"Can only draw in drawing phase");
|
||||
|
||||
//TODO: This is going to copy back pixels that we might end up
|
||||
// drawing over anyway. It would be nice if we could avoid
|
||||
// this duplication.
|
||||
mContentClient->SyncFrontBufferToBackBuffer();
|
||||
|
||||
bool canUseOpaqueSurface = CanUseOpaqueSurface();
|
||||
ContentType contentType =
|
||||
canUseOpaqueSurface ? GFX_CONTENT_COLOR :
|
||||
GFX_CONTENT_COLOR_ALPHA;
|
||||
|
||||
{
|
||||
mContentClient->PrepareFrame();
|
||||
|
||||
uint32_t flags = 0;
|
||||
#ifndef MOZ_WIDGET_ANDROID
|
||||
if (ClientManager()->CompositorMightResample()) {
|
||||
|
@ -59,27 +51,26 @@ ClientThebesLayer::PaintThebes()
|
|||
}
|
||||
#endif
|
||||
PaintState state =
|
||||
mContentClient->BeginPaintBuffer(this, contentType, flags);
|
||||
mContentClient->BeginPaintBuffer(this, flags);
|
||||
mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate);
|
||||
|
||||
if (state.mTarget) {
|
||||
if (DrawTarget* target = mContentClient->BorrowDrawTargetForPainting(this, state)) {
|
||||
// The area that became invalid and is visible needs to be repainted
|
||||
// (this could be the whole visible area if our buffer switched
|
||||
// from RGB to RGBA, because we might need to repaint with
|
||||
// subpixel AA)
|
||||
state.mRegionToInvalidate.And(state.mRegionToInvalidate,
|
||||
GetEffectiveVisibleRegion());
|
||||
nsIntRegion extendedDrawRegion = state.mRegionToDraw;
|
||||
SetAntialiasingFlags(this, state.mTarget);
|
||||
SetAntialiasingFlags(this, target);
|
||||
|
||||
nsRefPtr<gfxContext> ctx = gfxContext::ContextForDrawTarget(state.mTarget);
|
||||
nsRefPtr<gfxContext> ctx = gfxContext::ContextForDrawTarget(target);
|
||||
PaintBuffer(ctx,
|
||||
state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate,
|
||||
state.mRegionToDraw, state.mRegionToDraw, state.mRegionToInvalidate,
|
||||
state.mDidSelfCopy, state.mClip);
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this));
|
||||
Mutated();
|
||||
ctx = nullptr;
|
||||
mContentClient->ReturnDrawTarget(state.mTarget);
|
||||
mContentClient->ReturnDrawTarget(target);
|
||||
} else {
|
||||
// It's possible that state.mRegionToInvalidate is nonempty here,
|
||||
// if we are shrinking the valid region to nothing. So use mRegionToDraw
|
||||
|
|
Загрузка…
Ссылка в новой задаче