gl/msaa: Avoid stencil buffer stroking single line segment

When stroking a path that is a single line segment, avoid using the
stencil buffer. We do not have to worry about overlapping stroke
components in this case and the stencil buffer is expensive.
gl/msaa: Fast tessellation of simple arcs
gl: Instead of using glyph bbox, we use computed x_advance/y_advance to
check whether glyphs are overlapping.
gl: Lazy compositor for msaa compositor.

In msaa compositor for fill, we do not need create a pattern_base struct
and mask structure this saves some time.
gl/msaa: When reducing clip check just source.

In the cases we use it is enough and it avoids checking the mask
intersection.
gl/msaa: Lazy compositor for stroke.

Similar to lazy compositor for fill, we reduce composite_rectangles_init
time.
gl/msaa: Lazy compositor for mask.

In msaa compositor, similar to lazy init for paint/stroke/fill, we can do
same thing for mask
gl/msaa: Lazy compositor for paint.

Similar to lazy compositor for fill and stroke, we also partially
initialize composite_rectangles for msaa compositor.
gl/msaa: Lazy compositor for glyphs.

We do the similar lazy compositor for glyphs.
gl: Support using a non-texture gl surface as a source/mask in drawing.
gl/msaa: Add image "atlas" optimization.

In gl, we create a image atlas.  When an gl surface is to be painted to
target surface, we check whether the image can be cached into the atlas.
Using the image atlas, we can avoid flushing and rebinding textures of multiple
images if they are cached in the atlas.

For this version, we don't cache other backend surface yet.
gl/msaa: Implement hairline for stroke.

A hairline is a stroke of simplifies the tessellating algorithm
for stroking using other draw modes.
gl: Scale radial gradient parameters down may introduce rounding error.

Instead of using scaled parametes to generate uniform values, we
compute them from origin radial gradient pattern.
gl/msaa: Lazy initialization for glyph compute bounding box.

We do the initialization creating a mask that is big enough for text
instead of whole surface.
gl/msaa: Draw trap optimization.
NOT-FOR-UPSTREAM: gl: Don't check surface during context acquisition

Different drawable only means the gl context has different target window
or pixmap. In cairo case, we are OK because for offscreen rendering we
use FBO, for window or pixmap rendering, we always call _make_current.
In multithreaded application, different drivers behave differently.

For intel, the drawable is always 0 while context and display are not.
For nvidia, all three parameters are non-zero For fglrx, they are all 0.

FIXME: We can not upstream this patch until we can save/restore the
gl state properly.
NOT-FOR-UPSTREAM: gl: We must flush in gl_surface_clear.

This is a work-around for a bug in the Mali driver, but at this point we
don't know what bug or with what test case.
NOT-FOR-UPSTREAM: gl/msaa: Use cached clip on non-texture surfaces

Instead of just relying on a cached clip for texture surfaces only, also
allow for caching the clip on the stencil buffer of non-texture
surfaces. This will not work if the stencil buffer is modified outside
cairo.
NOT-FOR-UPSTREAM: test: Use a percentage to check if pixels have changed.

Increase the PERCEPTUAL_DIFF_THRESHOLD and use a percentage of the
size of the image to check it the change is perceptible.
NOT-FOR-UPSTREAM: gl/msaa: Cache more GL states to avoid redundant operations

Cache the active texture, the RGBA values of glClearColor,
blend functions, blend state, and depth mask state.

FIXME: this commit adds restrictions about how applications can use
the GL context when using cairo.