1,295
edits
| Line 131: | Line 131: | ||
gfxContext* beginDraw(const nsIntRegion& aVisibleRegion, | gfxContext* beginDraw(const nsIntRegion& aVisibleRegion, | ||
bool aOpaque, | |||
const nsIntRegion& aChangedRegion, | const nsIntRegion& aChangedRegion, | ||
nsIntRegion* aRegionToDraw); | nsIntRegion* aRegionToDraw); | ||
| Line 141: | Line 142: | ||
RenderedLayers are conceptually infinite in extent. Each RenderedLayer has an internal "valid region" which is finite. (An implementation would create a surface large enough to hold the entire valid region.) The initial valid region is empty. The implementation is allowed to discard all or part of the buffered contents of a RenderedLayer between transactions. Drawing into the RenderedLayer adds to the valid region, and discarding parts of the buffer removes from the valid region. | RenderedLayers are conceptually infinite in extent. Each RenderedLayer has an internal "valid region" which is finite. (An implementation would create a surface large enough to hold the entire valid region.) The initial valid region is empty. The implementation is allowed to discard all or part of the buffered contents of a RenderedLayer between transactions. Drawing into the RenderedLayer adds to the valid region, and discarding parts of the buffer removes from the valid region. | ||
When calling beginDraw, the caller specifies in aVisibleRegion a region that needs to be valid when drawing is done. (This is the area that will be visible to the user.) The caller can also specify aChangedRegion to indicate that content in that region has changed and will need to be repainted. The implementation returns aRegionToDraw to indicate the area that must be repainted. Typically this will be | When calling beginDraw, the caller specifies in aVisibleRegion a region that needs to be valid when drawing is done. (This is the area that will be visible to the user.) The caller can also specify aChangedRegion to indicate that content in that region has changed and will need to be repainted. The implementation returns aRegionToDraw to indicate the area that must be repainted. Typically this will be aVisibleRegion minus (the currently valid region minus aChangedRegion). aRegionToDraw must not extend outside aVisibleRegion. aRegionToDraw is added to the valid region. The returned gfxContext is clipped to aRegionToDraw. | ||
In beginDraw, when 'aOpaque' is true, the caller promises to fill the entire aRegionToDraw with opaque content. The implementation may be able to use this for optimizations, especially for the drawing of subpixel-antialiased text. | |||
The content in a RenderedLayer can change size. If the size decreases, aChangedRegion will include the area of content that has gone away, and aVisibleRegion will exclude that area. The implementation may trim its buffers appropriately. If the size increases the implementation will need to increase the buffer. | The content in a RenderedLayer can change size. If the size decreases, aChangedRegion will include the area of content that has gone away, and aVisibleRegion will exclude that area. The implementation may trim its buffers appropriately. If the size increases the implementation will need to increase the buffer. | ||
edits