Bug 539356 - Part 2 - Add new API to BasicLayers. r=roc

This commit is contained in:
Matt Woodrow 2012-07-17 13:03:51 -04:00
parent d857e4f101
commit 8c49e4a361
2 changed files with 11 additions and 3 deletions

View File

@ -229,6 +229,12 @@ public:
virtual ShadowLayerManager* AsShadowManager() virtual ShadowLayerManager* AsShadowManager()
{ return nsnull; } { return nsnull; }
/**
* Returns true if this LayerManager is owned by an nsIWidget,
* and is used for drawing into the widget.
*/
virtual bool IsWidgetLayerManager() { return true; }
/** /**
* Start a new transaction. Nested transactions are not allowed so * Start a new transaction. Nested transactions are not allowed so
* there must be no transaction currently in progress. * there must be no transaction currently in progress.

View File

@ -86,6 +86,8 @@ public:
nsIWidget* GetRetainerWidget() { return mWidget; } nsIWidget* GetRetainerWidget() { return mWidget; }
void ClearRetainerWidget() { mWidget = nsnull; } void ClearRetainerWidget() { mWidget = nsnull; }
virtual bool IsWidgetLayerManager() { return mWidget != nsnull; }
virtual void BeginTransaction(); virtual void BeginTransaction();
virtual void BeginTransactionWithTarget(gfxContext* aTarget); virtual void BeginTransactionWithTarget(gfxContext* aTarget);
virtual bool EndEmptyTransaction(); virtual bool EndEmptyTransaction();
@ -121,9 +123,11 @@ public:
bool InConstruction() { return mPhase == PHASE_CONSTRUCTION; } bool InConstruction() { return mPhase == PHASE_CONSTRUCTION; }
bool InDrawing() { return mPhase == PHASE_DRAWING; } bool InDrawing() { return mPhase == PHASE_DRAWING; }
bool InForward() { return mPhase == PHASE_FORWARD; } bool InForward() { return mPhase == PHASE_FORWARD; }
bool InTransaction() { return mPhase != PHASE_NONE; }
#endif #endif
bool InTransaction() { return mPhase != PHASE_NONE; }
gfxContext* GetTarget() { return mTarget; } gfxContext* GetTarget() { return mTarget; }
void SetTarget(gfxContext* aTarget) { mUsingDefaultTarget = false; mTarget = aTarget; }
bool IsRetained() { return mWidget != nsnull; } bool IsRetained() { return mWidget != nsnull; }
#ifdef MOZ_LAYERS_HAVE_LOG #ifdef MOZ_LAYERS_HAVE_LOG
@ -149,12 +153,10 @@ public:
virtual PRInt32 GetMaxTextureSize() const { return PR_INT32_MAX; } virtual PRInt32 GetMaxTextureSize() const { return PR_INT32_MAX; }
protected: protected:
#ifdef DEBUG
enum TransactionPhase { enum TransactionPhase {
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
}; };
TransactionPhase mPhase; TransactionPhase mPhase;
#endif
// Paints aLayer to mTarget. // Paints aLayer to mTarget.
void PaintLayer(gfxContext* aTarget, void PaintLayer(gfxContext* aTarget,