Bug 793365: Make sure (again) that the entire buffer is valid when we might be asynchronously composited. r=roc
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "mozilla/dom/TabChild.h"
|
||||||
#include "mozilla/layers/PLayerChild.h"
|
#include "mozilla/layers/PLayerChild.h"
|
||||||
#include "mozilla/layers/PLayersChild.h"
|
#include "mozilla/layers/PLayersChild.h"
|
||||||
#include "mozilla/layers/PLayersParent.h"
|
#include "mozilla/layers/PLayersParent.h"
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
|
|
||||||
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@@ -215,6 +217,7 @@ BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) :
|
|||||||
, mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(false)
|
, mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(false)
|
||||||
, mCachedSurfaceInUse(false)
|
, mCachedSurfaceInUse(false)
|
||||||
, mTransactionIncomplete(false)
|
, mTransactionIncomplete(false)
|
||||||
|
, mCompositorMightResample(false)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(BasicLayerManager);
|
MOZ_COUNT_CTOR(BasicLayerManager);
|
||||||
NS_ASSERTION(aWidget, "Must provide a widget");
|
NS_ASSERTION(aWidget, "Must provide a widget");
|
||||||
@@ -1090,6 +1093,17 @@ BasicShadowLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
|||||||
if (HasShadowManager()) {
|
if (HasShadowManager()) {
|
||||||
ShadowLayerForwarder::BeginTransaction(mTargetBounds, mTargetRotation);
|
ShadowLayerForwarder::BeginTransaction(mTargetBounds, mTargetRotation);
|
||||||
|
|
||||||
|
// If we're drawing on behalf of a context with async pan/zoom
|
||||||
|
// enabled, then the entire buffer of thebes layers might be
|
||||||
|
// composited (including resampling) asynchronously before we get
|
||||||
|
// a chance to repaint, so we have to ensure that it's all valid
|
||||||
|
// and not rotated.
|
||||||
|
if (mWidget) {
|
||||||
|
if (TabChild* window = mWidget->GetOwningTabChild()) {
|
||||||
|
mCompositorMightResample = window->IsAsyncPanZoomEnabled();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we have a non-default target, we need to let our shadow manager draw
|
// If we have a non-default target, we need to let our shadow manager draw
|
||||||
// to it. This will happen at the end of the transaction.
|
// to it. This will happen at the end of the transaction.
|
||||||
if (aTarget && (aTarget != mDefaultTarget) &&
|
if (aTarget && (aTarget != mDefaultTarget) &&
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ public:
|
|||||||
|
|
||||||
virtual bool IsCompositingCheap() { return false; }
|
virtual bool IsCompositingCheap() { return false; }
|
||||||
virtual int32_t GetMaxTextureSize() const { return PR_INT32_MAX; }
|
virtual int32_t GetMaxTextureSize() const { return PR_INT32_MAX; }
|
||||||
|
bool CompositorMightResample() { return mCompositorMightResample; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum TransactionPhase {
|
enum TransactionPhase {
|
||||||
@@ -200,10 +201,11 @@ protected:
|
|||||||
// Cached surface for double buffering
|
// Cached surface for double buffering
|
||||||
gfxCachedTempSurface mCachedSurface;
|
gfxCachedTempSurface mCachedSurface;
|
||||||
|
|
||||||
BufferMode mDoubleBuffering;
|
BufferMode mDoubleBuffering;
|
||||||
bool mUsingDefaultTarget;
|
bool mUsingDefaultTarget;
|
||||||
bool mCachedSurfaceInUse;
|
bool mCachedSurfaceInUse;
|
||||||
bool mTransactionIncomplete;
|
bool mTransactionIncomplete;
|
||||||
|
bool mCompositorMightResample;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,10 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "BasicThebesLayer.h"
|
#include "BasicThebesLayer.h"
|
||||||
|
#include "gfxUtils.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "RenderTrace.h"
|
#include "RenderTrace.h"
|
||||||
#include "sampler.h"
|
#include "sampler.h"
|
||||||
#include "gfxUtils.h"
|
|
||||||
|
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
|
|
||||||
@@ -156,12 +155,17 @@ BasicThebesLayer::PaintThebes(gfxContext* aContext,
|
|||||||
|
|
||||||
{
|
{
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
#ifndef MOZ_GFX_OPTIMIZE_MOBILE
|
#ifndef MOZ_WIDGET_ANDROID
|
||||||
gfxMatrix transform;
|
if (BasicManager()->CompositorMightResample()) {
|
||||||
if (!GetEffectiveTransform().CanDraw2D(&transform) ||
|
|
||||||
transform.HasNonIntegerTranslation()) {
|
|
||||||
flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE;
|
flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE;
|
||||||
}
|
}
|
||||||
|
if (!(flags & ThebesLayerBuffer::PAINT_WILL_RESAMPLE)) {
|
||||||
|
gfxMatrix transform;
|
||||||
|
if (!GetEffectiveTransform().CanDraw2D(&transform) ||
|
||||||
|
transform.HasNonIntegerTranslation()) {
|
||||||
|
flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (mDrawAtomically) {
|
if (mDrawAtomically) {
|
||||||
flags |= ThebesLayerBuffer::PAINT_NO_ROTATION;
|
flags |= ThebesLayerBuffer::PAINT_NO_ROTATION;
|
||||||
|
|||||||
@@ -1623,6 +1623,12 @@ class nsIWidget : public nsISupports {
|
|||||||
*/
|
*/
|
||||||
virtual const SizeConstraints& GetSizeConstraints() const = 0;
|
virtual const SizeConstraints& GetSizeConstraints() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this is owned by a TabChild, return that. Otherwise return
|
||||||
|
* null.
|
||||||
|
*/
|
||||||
|
virtual TabChild* GetOwningTabChild() { return nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// keep the list of children. We also keep track of our siblings.
|
// keep the list of children. We also keep track of our siblings.
|
||||||
|
|||||||
@@ -172,6 +172,8 @@ public:
|
|||||||
// later on.
|
// later on.
|
||||||
virtual float GetDPI();
|
virtual float GetDPI();
|
||||||
|
|
||||||
|
virtual TabChild* GetOwningTabChild() MOZ_OVERRIDE { return mTabChild; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsresult Paint();
|
nsresult Paint();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user