Bug 929513 Part 2: Use gfx::IntSize for TiledContentClient's resolution r=nical

This commit is contained in:
David Zbarsky 2013-10-27 17:53:27 -04:00
parent b28c18df90
commit 495b7b0c6a
7 changed files with 18 additions and 20 deletions

View File

@ -421,7 +421,7 @@ BasicTiledLayerBuffer::ValidateTile(BasicTiledLayerTile aTile,
static nsIntRect
RoundedTransformViewportBounds(const gfx::Rect& aViewport,
const CSSPoint& aScrollOffset,
const gfxSize& aResolution,
const LayerSize& aResolution,
float aScaleX,
float aScaleY,
const gfx3DMatrix& aTransform)

View File

@ -14,7 +14,6 @@
#include "Units.h" // for CSSPoint
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxTypes.h"
#include "gfxPoint.h" // for gfxSize
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/CompositableClient.h" // for CompositableClient
@ -108,7 +107,7 @@ struct BasicTiledLayerPaintData {
CSSPoint mLastScrollOffset;
gfx3DMatrix mTransformScreenToLayer;
nsIntRect mLayerCriticalDisplayPort;
gfxSize mResolution;
LayerSize mResolution;
nsIntRect mCompositionBounds;
uint16_t mLowPrecisionPaintCount;
bool mFirstPaint : 1;
@ -180,8 +179,8 @@ public:
}
}
const gfxSize& GetFrameResolution() { return mFrameResolution; }
void SetFrameResolution(const gfxSize& aResolution) { mFrameResolution = aResolution; }
const LayerSize& GetFrameResolution() { return mFrameResolution; }
void SetFrameResolution(const LayerSize& aResolution) { mFrameResolution = aResolution; }
bool HasFormatChanged() const;
@ -226,7 +225,7 @@ private:
ClientLayerManager* mManager;
LayerManager::DrawThebesLayerCallback mCallback;
void* mCallbackData;
gfxSize mFrameResolution;
LayerSize mFrameResolution;
bool mLastPaintOpaque;
// The buffer we use when UseSinglePaintBuffer() above is true.

View File

@ -8,7 +8,6 @@
#include <stdint.h> // for uint64_t
#include <stdio.h> // for FILE
#include "gfxPoint.h" // for gfxSize
#include "gfxRect.h" // for gfxRect
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
@ -24,6 +23,7 @@
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsRegion.h" // for nsIntRegion
#include "nscore.h" // for nsACString
#include "Units.h"
class gfxImageSurface;
struct nsIntPoint;
@ -42,7 +42,7 @@ struct TiledLayerProperties
nsIntRegion mVisibleRegion;
nsIntRegion mValidRegion;
gfxRect mDisplayPort;
gfxSize mEffectiveResolution;
LayerSize mEffectiveResolution;
gfxRect mCompositionBounds;
bool mRetainTiles;
};

View File

@ -176,7 +176,7 @@ ThebesLayerComposite::CleanupResources()
mBuffer = nullptr;
}
gfxSize
LayerSize
ThebesLayerComposite::GetEffectiveResolution()
{
// Work out render resolution by multiplying the resolution of our ancestors.
@ -184,7 +184,7 @@ ThebesLayerComposite::GetEffectiveResolution()
// resolution of 1, 1.
// XXX For large layer trees, it would be faster to do this once from the
// root node upwards and store the value on each layer.
gfxSize resolution(1, 1);
LayerSize resolution(1, 1);
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
const FrameMetrics& metrics = parent->GetFrameMetrics();
resolution.width *= metrics.mResolution.scale;
@ -206,7 +206,7 @@ ThebesLayerComposite::GetDisplayPort()
// Find out the area of the nearest display-port to invalidate retained
// tiles.
gfxRect displayPort;
gfxSize parentResolution = GetEffectiveResolution();
LayerSize parentResolution = GetEffectiveResolution();
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
const FrameMetrics& metrics = parent->GetFrameMetrics();
if (displayPort.IsEmpty()) {

View File

@ -86,7 +86,7 @@ protected:
private:
gfxRect GetDisplayPort();
gfxSize GetEffectiveResolution();
LayerSize GetEffectiveResolution();
gfxRect GetCompositionBounds();
RefPtr<ContentHost> mBuffer;

View File

@ -28,7 +28,7 @@ void
TiledLayerBufferComposite::Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
const nsIntRegion& aNewValidRegion,
const nsIntRegion& aInvalidateRegion,
const gfxSize& aResolution)
const LayerSize& aResolution)
{
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
printf_stderr("Upload %i, %i, %i, %i\n", aInvalidateRegion.GetBounds().x, aInvalidateRegion.GetBounds().y, aInvalidateRegion.GetBounds().width, aInvalidateRegion.GetBounds().height);
@ -227,12 +227,12 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
return;
}
float resolution = aLayerBuffer.GetResolution();
gfxSize layerScale(1, 1);
LayerSize layerScale(1, 1);
// We assume that the current frame resolution is the one used in our primary
// layer buffer. Compensate for a changing frame resolution.
if (aLayerBuffer.GetFrameResolution() != mVideoMemoryTiledBuffer.GetFrameResolution()) {
const gfxSize& layerResolution = aLayerBuffer.GetFrameResolution();
const gfxSize& localResolution = mVideoMemoryTiledBuffer.GetFrameResolution();
const LayerSize& layerResolution = aLayerBuffer.GetFrameResolution();
const LayerSize& localResolution = mVideoMemoryTiledBuffer.GetFrameResolution();
layerScale.width = layerResolution.width / localResolution.width;
layerScale.height = layerResolution.height / localResolution.height;
aVisibleRect.ScaleRoundOut(layerScale.width, layerScale.height);

View File

@ -12,7 +12,6 @@
#include "ContentHost.h" // for ContentHost
#include "TiledLayerBuffer.h" // for TiledLayerBuffer, etc
#include "CompositableHost.h"
#include "gfxPoint.h" // for gfxSize
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
#include "mozilla/RefPtr.h" // for RefPtr
@ -106,13 +105,13 @@ public:
void Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
const nsIntRegion& aNewValidRegion,
const nsIntRegion& aInvalidateRegion,
const gfxSize& aResolution);
const LayerSize& aResolution);
TiledTexture GetPlaceholderTile() const { return TiledTexture(); }
// Stores the absolute resolution of the containing frame, calculated
// by the sum of the resolutions of all parent layers' FrameMetrics.
const gfxSize& GetFrameResolution() { return mFrameResolution; }
const LayerSize& GetFrameResolution() { return mFrameResolution; }
void SetCompositor(Compositor* aCompositor)
{
@ -134,7 +133,7 @@ protected:
private:
Compositor* mCompositor;
const BasicTiledLayerBuffer* mMainMemoryTiledBuffer;
gfxSize mFrameResolution;
LayerSize mFrameResolution;
};
/**