Bug 818169 - Add a pref to configure resolution of low precision buffer. r=bgirard

This commit is contained in:
Chris Lord 2012-12-05 17:10:41 +00:00
parent 1d8ec56f57
commit f192c200fc
5 changed files with 38 additions and 16 deletions

View File

@ -238,6 +238,20 @@ BasicTiledLayerBuffer::ValidateTile(BasicTiledLayerTile aTile,
return aTile;
}
BasicTiledThebesLayer::BasicTiledThebesLayer(BasicShadowLayerManager* const aManager)
: ThebesLayer(aManager, static_cast<BasicImplData*>(this))
, mLastScrollOffset(0, 0)
, mFirstPaint(true)
{
MOZ_COUNT_CTOR(BasicTiledThebesLayer);
mLowPrecisionTiledBuffer.SetResolution(gfxPlatform::GetLowPrecisionResolution());
}
BasicTiledThebesLayer::~BasicTiledThebesLayer()
{
MOZ_COUNT_DTOR(BasicTiledThebesLayer);
}
void
BasicTiledThebesLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{

View File

@ -12,8 +12,6 @@
#include "BasicImplData.h"
#include <algorithm>
#define LOW_PRECISION_RESOLUTION 0.25
namespace mozilla {
namespace layers {
@ -176,20 +174,8 @@ class BasicTiledThebesLayer : public ThebesLayer,
typedef ThebesLayer Base;
public:
BasicTiledThebesLayer(BasicShadowLayerManager* const aManager)
: ThebesLayer(aManager, static_cast<BasicImplData*>(this))
, mLastScrollOffset(0, 0)
, mFirstPaint(true)
{
MOZ_COUNT_CTOR(BasicTiledThebesLayer);
mLowPrecisionTiledBuffer.SetResolution(LOW_PRECISION_RESOLUTION);
}
~BasicTiledThebesLayer()
{
MOZ_COUNT_DTOR(BasicTiledThebesLayer);
}
BasicTiledThebesLayer(BasicShadowLayerManager* const aManager);
~BasicTiledThebesLayer();
// Thebes Layer
virtual Layer* AsLayer() { return this; }

View File

@ -1262,6 +1262,24 @@ gfxPlatform::UseLowPrecisionBuffer()
return sUseLowPrecisionBuffer;
}
float
gfxPlatform::GetLowPrecisionResolution()
{
static float sLowPrecisionResolution;
static bool sLowPrecisionResolutionPrefCached = false;
if (!sLowPrecisionResolutionPrefCached) {
int32_t lowPrecisionResolution = 250;
sLowPrecisionResolutionPrefCached = true;
mozilla::Preferences::AddIntVarCache(&lowPrecisionResolution,
"layers.low-precision-resolution",
250);
sLowPrecisionResolution = lowPrecisionResolution / 1000.f;
}
return sLowPrecisionResolution;
}
bool
gfxPlatform::UseReusableTileStore()
{

View File

@ -409,6 +409,9 @@ public:
// it into a buffer at a lower precision. Requires tiled buffers.
static bool UseLowPrecisionBuffer();
// Retrieve the resolution that a low precision buffer should render at.
static float GetLowPrecisionResolution();
// Retain some invalid tiles when the valid region of a layer changes and
// excludes previously valid tiles.
static bool UseReusableTileStore();

View File

@ -524,6 +524,7 @@ pref("layers.offmainthreadcomposition.enabled", true);
pref("layers.async-video.enabled", true);
pref("layers.progressive-paint", true);
pref("layers.low-precision-buffer", true);
pref("layers.low-precision-resolution", 250);
pref("notification.feature.enabled", true);