зеркало из https://github.com/mozilla/gecko-dev.git
Bug 627273, part 1: API for tiling Layers. r=Bas sr=roc
This commit is contained in:
Родитель
392993ecf7
Коммит
c7c39d08c5
|
@ -456,6 +456,9 @@ Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
|
|||
if (1.0 != mOpacity) {
|
||||
aTo.AppendPrintf(" [opacity=%g]", mOpacity);
|
||||
}
|
||||
if (const nsIntRect* tileSourceRect = GetTileSourceRect()) {
|
||||
AppendToString(aTo, *tileSourceRect, " [tileSrc=", "]");
|
||||
}
|
||||
if (GetContentFlags() & CONTENT_OPAQUE) {
|
||||
aTo += " [opaqueContent]";
|
||||
}
|
||||
|
|
|
@ -622,6 +622,35 @@ public:
|
|||
Mutated();
|
||||
}
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
*
|
||||
* Define a subrect of this layer that will be used as the source
|
||||
* image for tiling this layer's visible region. The coordinates
|
||||
* are in the un-transformed space of this layer (i.e. the visible
|
||||
* region of this this layer is tiled before being transformed).
|
||||
* The visible region is tiled "outwards" from the source rect; that
|
||||
* is, the source rect is drawn "in place", then repeated to cover
|
||||
* the layer's visible region.
|
||||
*
|
||||
* The interpretation of the source rect varies depending on
|
||||
* underlying layer type. For ImageLayers and CanvasLayers, it
|
||||
* doesn't make sense to set a source rect not fully contained by
|
||||
* the bounds of their underlying images. For ThebesLayers, thebes
|
||||
* content may need to be rendered to fill the source rect. For
|
||||
* ColorLayers, a source rect for tiling doesn't make sense at all.
|
||||
*
|
||||
* If aRect is null no tiling will be performed.
|
||||
*/
|
||||
void SetTileSourceRect(const nsIntRect* aRect)
|
||||
{
|
||||
mUseTileSourceRect = aRect != nsnull;
|
||||
if (aRect) {
|
||||
mTileSourceRect = *aRect;
|
||||
}
|
||||
Mutated();
|
||||
}
|
||||
|
||||
// These getters can be used anytime.
|
||||
float GetOpacity() { return mOpacity; }
|
||||
const nsIntRect* GetClipRect() { return mUseClipRect ? &mClipRect : nsnull; }
|
||||
|
@ -633,6 +662,7 @@ public:
|
|||
virtual Layer* GetFirstChild() { return nsnull; }
|
||||
virtual Layer* GetLastChild() { return nsnull; }
|
||||
const gfx3DMatrix& GetTransform() { return mTransform; }
|
||||
const nsIntRect* GetTileSourceRect() { return mUseTileSourceRect ? &mTileSourceRect : nsnull; }
|
||||
|
||||
/**
|
||||
* DRAWING PHASE ONLY
|
||||
|
@ -792,7 +822,8 @@ protected:
|
|||
mImplData(aImplData),
|
||||
mOpacity(1.0),
|
||||
mContentFlags(0),
|
||||
mUseClipRect(PR_FALSE)
|
||||
mUseClipRect(PR_FALSE),
|
||||
mUseTileSourceRect(PR_FALSE)
|
||||
{}
|
||||
|
||||
void Mutated() { mManager->Mutated(this); }
|
||||
|
@ -836,8 +867,10 @@ protected:
|
|||
gfx3DMatrix mEffectiveTransform;
|
||||
float mOpacity;
|
||||
nsIntRect mClipRect;
|
||||
nsIntRect mTileSourceRect;
|
||||
PRUint32 mContentFlags;
|
||||
PRPackedBool mUseClipRect;
|
||||
PRPackedBool mUseTileSourceRect;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче