Bug 1065558 - Add a ConcatTransform method to Moz2D's DrawTarget. r=Bas

This commit is contained in:
Jonathan Watt 2014-09-10 21:41:50 +01:00
parent 2626e5a693
commit 28834bab10

View File

@ -965,10 +965,26 @@ public:
/**
* Set a transform on the surface, this transform is applied at drawing time
* to both the mask and source of the operation.
*
* Performance note: For some backends it is expensive to change the current
* transform (because transforms affect a lot of the parts of the pipeline,
* so new transform change can result in a pipeline flush). To get around
* this, DrawTarget implementations buffer transform changes and try to only
* set the current transform on the backend when required. That tracking has
* its own performance impact though, and ideally callers would be smart
* enough not to require it. At a future date this method may stop this
* doing transform buffering so, if you're a consumer, please try to be smart
* about calling this method as little as possible. For example, instead of
* concatenating a translation onto the current transform then calling
* FillRect, try to integrate the translation into FillRect's aRect
* argument's x/y offset.
*/
virtual void SetTransform(const Matrix &aTransform)
{ mTransform = aTransform; mTransformDirty = true; }
inline void ConcatTransform(const Matrix &aTransform)
{ SetTransform(aTransform * Matrix(GetTransform())); }
SurfaceFormat GetFormat() { return mFormat; }
/** Tries to get a native surface for a DrawTarget, this may fail if the