DescriptionWork in progress to make SkShader immutable.
Currently, SkShader is modified by each draw call. SkShader::setContext
is called with information about the the current state (device, matrix
paint). Each SkShader subclass caches information about that state,
which is later used by the various flavors of shadeSpan (or a
ShadeProc).
In this CL, the caches are moved from the SkShader to a new object,
called SkShader::Context. setContext, no longer a virtual function, now
creates a Context. It then asks its subclass how much extra space is
needed for drawing. It allocates (or places in existing storage) enough
space for the subclass on the Context, and passes it to the subclass
via onSetContext. The new virtual function onSetContext does the work
of the old setContext, only it places its subclass specific info on
the Context. Now, each version of shadeSpan takes the Context as a
parameter, so the SkShader can get its cached information for drawing.
endContext now takes the Context as a parameter (and deletes it).
The Context is stored on the SkBlitter, which takes care of passing
it to each shadeSpan and finally calling endContext.
BUG=skia:1976
Patch Set 1 #
Messages
Total messages: 8 (0 generated)
|