зеркало из https://github.com/mozilla/gecko-dev.git
Bug 711063 - Part 10: Adjust BasicLayers code for Azure-Thebes wrapper. r=roc
This commit is contained in:
Родитель
62a6a9a512
Коммит
025867f5d9
|
@ -609,6 +609,11 @@ IntersectWithClip(const nsIntRegion& aRegion, gfxContext* aContext)
|
||||||
static void
|
static void
|
||||||
SetAntialiasingFlags(Layer* aLayer, gfxContext* aTarget)
|
SetAntialiasingFlags(Layer* aLayer, gfxContext* aTarget)
|
||||||
{
|
{
|
||||||
|
if (!aTarget->IsCairo()) {
|
||||||
|
// Azure targets don't contain antialiasing flags at this point.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> surface = aTarget->CurrentSurface();
|
nsRefPtr<gfxASurface> surface = aTarget->CurrentSurface();
|
||||||
if (surface->GetContentType() != gfxASurface::CONTENT_COLOR_ALPHA) {
|
if (surface->GetContentType() != gfxASurface::CONTENT_COLOR_ALPHA) {
|
||||||
// Destination doesn't have alpha channel; no need to set any special flags
|
// Destination doesn't have alpha channel; no need to set any special flags
|
||||||
|
@ -933,14 +938,16 @@ BasicImageLayer::PaintContext(gfxPattern* aPattern,
|
||||||
// outside the bounds of the video image.
|
// outside the bounds of the video image.
|
||||||
gfxPattern::GraphicsExtend extend = gfxPattern::EXTEND_PAD;
|
gfxPattern::GraphicsExtend extend = gfxPattern::EXTEND_PAD;
|
||||||
|
|
||||||
// PAD is slow with X11 and Quartz surfaces, so prefer speed over correctness
|
if (aContext->IsCairo()) {
|
||||||
// and use NONE.
|
// PAD is slow with X11 and Quartz surfaces, so prefer speed over correctness
|
||||||
nsRefPtr<gfxASurface> target = aContext->CurrentSurface();
|
// and use NONE.
|
||||||
gfxASurface::gfxSurfaceType type = target->GetType();
|
nsRefPtr<gfxASurface> target = aContext->CurrentSurface();
|
||||||
if (type == gfxASurface::SurfaceTypeXlib ||
|
gfxASurface::gfxSurfaceType type = target->GetType();
|
||||||
type == gfxASurface::SurfaceTypeXcb ||
|
if (type == gfxASurface::SurfaceTypeXlib ||
|
||||||
type == gfxASurface::SurfaceTypeQuartz) {
|
type == gfxASurface::SurfaceTypeXcb ||
|
||||||
extend = gfxPattern::EXTEND_NONE;
|
type == gfxASurface::SurfaceTypeQuartz) {
|
||||||
|
extend = gfxPattern::EXTEND_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aTileSourceRect) {
|
if (!aTileSourceRect) {
|
||||||
|
@ -1337,7 +1344,8 @@ already_AddRefed<gfxContext>
|
||||||
BasicLayerManager::PushGroupWithCachedSurface(gfxContext *aTarget,
|
BasicLayerManager::PushGroupWithCachedSurface(gfxContext *aTarget,
|
||||||
gfxASurface::gfxContentType aContent)
|
gfxASurface::gfxContentType aContent)
|
||||||
{
|
{
|
||||||
if (mCachedSurfaceInUse) {
|
if (mCachedSurfaceInUse || !aTarget->IsCairo()) {
|
||||||
|
// We can't cache Azure DrawTargets at this point.
|
||||||
aTarget->PushGroup(aContent);
|
aTarget->PushGroup(aContent);
|
||||||
nsRefPtr<gfxContext> result = aTarget;
|
nsRefPtr<gfxContext> result = aTarget;
|
||||||
return result.forget();
|
return result.forget();
|
||||||
|
@ -1363,7 +1371,7 @@ BasicLayerManager::PopGroupToSourceWithCachedSurface(gfxContext *aTarget, gfxCon
|
||||||
if (!aTarget)
|
if (!aTarget)
|
||||||
return;
|
return;
|
||||||
nsRefPtr<gfxASurface> current = aPushed->CurrentSurface();
|
nsRefPtr<gfxASurface> current = aPushed->CurrentSurface();
|
||||||
if (mCachedSurface.IsSurface(current)) {
|
if (aTarget->IsCairo() && mCachedSurface.IsSurface(current)) {
|
||||||
gfxContextMatrixAutoSaveRestore saveMatrix(aTarget);
|
gfxContextMatrixAutoSaveRestore saveMatrix(aTarget);
|
||||||
aTarget->IdentityMatrix();
|
aTarget->IdentityMatrix();
|
||||||
aTarget->SetSource(current);
|
aTarget->SetSource(current);
|
||||||
|
@ -1852,17 +1860,20 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
|
||||||
|
|
||||||
bool pushedTargetOpaqueRect = false;
|
bool pushedTargetOpaqueRect = false;
|
||||||
nsRefPtr<gfxASurface> currentSurface = aTarget->CurrentSurface();
|
nsRefPtr<gfxASurface> currentSurface = aTarget->CurrentSurface();
|
||||||
const gfxRect& targetOpaqueRect = currentSurface->GetOpaqueRect();
|
|
||||||
|
|
||||||
// Try to annotate currentSurface with a region of pixels that have been
|
|
||||||
// (or will be) painted opaque, if no such region is currently set.
|
|
||||||
const nsIntRect& bounds = visibleRegion.GetBounds();
|
const nsIntRect& bounds = visibleRegion.GetBounds();
|
||||||
if (targetOpaqueRect.IsEmpty() && visibleRegion.GetNumRects() == 1 &&
|
|
||||||
(aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) &&
|
if (aTarget->IsCairo()) {
|
||||||
!transform.HasNonAxisAlignedTransform()) {
|
const gfxRect& targetOpaqueRect = currentSurface->GetOpaqueRect();
|
||||||
currentSurface->SetOpaqueRect(
|
|
||||||
aTarget->UserToDevice(gfxRect(bounds.x, bounds.y, bounds.width, bounds.height)));
|
// Try to annotate currentSurface with a region of pixels that have been
|
||||||
pushedTargetOpaqueRect = true;
|
// (or will be) painted opaque, if no such region is currently set.
|
||||||
|
if (targetOpaqueRect.IsEmpty() && visibleRegion.GetNumRects() == 1 &&
|
||||||
|
(aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) &&
|
||||||
|
!transform.HasNonAxisAlignedTransform()) {
|
||||||
|
currentSurface->SetOpaqueRect(
|
||||||
|
aTarget->UserToDevice(gfxRect(bounds.x, bounds.y, bounds.width, bounds.height)));
|
||||||
|
pushedTargetOpaqueRect = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<gfxContext> groupTarget;
|
nsRefPtr<gfxContext> groupTarget;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче