public class CacheFilter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
CacheFilter.ScrollCacheState
Defines the state when we're in the midst of scrolling a cached image
|
Modifier and Type | Field and Description |
---|---|
private Rectangle |
cacheBounds |
private ImageData |
cachedImageData |
private double |
cachedRotate |
private double |
cachedScaleX |
private double |
cachedScaleY |
private double |
cachedX |
private Affine2D |
cachedXform |
private double |
cachedY |
private CacheHint |
cacheHint |
private static double |
EPSILON |
private double |
lastXDelta |
private double |
lastYDelta |
private NGNode |
node |
private boolean |
rotateHint |
private boolean |
scaleHint |
private Affine2D |
screenXform |
private CacheFilter.ScrollCacheState |
scrollCacheState |
private static RectBounds |
TEMP_BOUNDS |
private static Affine3D |
TEMP_CACHEFILTER_TRANSFORM |
private static DirtyRegionContainer |
TEMP_CONTAINER |
private static Rectangle |
TEMP_RECT |
private RTTexture |
tempTexture |
private boolean |
wasUnsupported |
Modifier | Constructor and Description |
---|---|
protected |
CacheFilter(NGNode node,
CacheHint cacheHint) |
Modifier and Type | Method and Description |
---|---|
(package private) BaseBounds |
computeDirtyBounds(BaseBounds region,
BaseTransform tx,
GeneralTransform3D pvTx) |
private Rectangle |
computeDirtyRegionForTranslate()
Compute the dirty region that must be re-rendered after scrolling
|
void |
dispose() |
(package private) void |
imageDataUnref() |
(package private) ImageData |
impl_createImageData(FilterContext fctx,
Rectangle bounds)
Create the ImageData for the cached bitmap, with the specified bounds.
|
(package private) Rectangle |
impl_getCacheBounds(Rectangle bounds,
BaseTransform xform)
Get the cache bounds.
|
(package private) void |
impl_moveCacheBy(ImageData cachedImageData,
double xDelta,
double yDelta)
Moves a subregion of the cache, "scrolling" the cache by x/y Delta.
|
(package private) void |
impl_renderCacheToScreen(java.lang.Object implGraphics,
Filterable implImage,
double mxt,
double myt)
Render the cached image to the screen, translated by mxt, myt.
|
(package private) void |
impl_renderNodeToCache(ImageData cacheData,
Rectangle cacheBounds,
BaseTransform xform,
Rectangle dirtyBounds)
Render node to cache.
|
(package private) void |
impl_renderNodeToScreen(java.lang.Object implGraphics)
Render the node directly to the screen, in the case that the cached
image is unexpectedly null.
|
(package private) boolean |
impl_scrollCacheCapable()
True if we can use scrolling optimization on this node.
|
void |
invalidate() |
(package private) void |
invalidateByTranslation(double translateXDelta,
double translateYDelta) |
(package private) boolean |
isRotateHint() |
(package private) boolean |
isScaleHint() |
private boolean |
isXformScrollCacheCapable(double[] xformInfo) |
(package private) boolean |
matchesHint(CacheHint cacheHint)
Indicates whether this CacheFilter's hint matches the CacheHint
passed in.
|
private boolean |
needToRenderCache(BaseTransform renderXform,
double[] xformInfo,
float pixelScale) |
(package private) void |
render(Graphics g) |
void |
setHint(CacheHint cacheHint) |
(package private) double[] |
unmatrix(BaseTransform xform)
Given a BaseTransform, decompose it into values for scaleX, scaleY and
rotate.
|
(package private) boolean |
unsupported(double[] xformInfo)
Are we attempting to use cache for an unsupported transform mode? Mostly
this is for trying to rotate while scaling the object by different
amounts in the x and y directions (this also includes shearing).
|
(package private) void |
updateScreenXform(double[] xformInfo) |
(package private) void |
v2combine(double[] v0,
double[] v1,
double[] result,
double scalarA,
double scalarB)
make a linear combination of two vectors and return the result
result = (v0 * scalarA) + (v1 * scalarB)
From V3Combine() in GGVecLib.c
|
(package private) double |
v2dot(double[] v0,
double[] v1)
dot product of 2 vectors of length 2
|
(package private) double |
v2length(double[] v)
returns length of input vector
Based on V3Length() in GGVecLib.c
|
(package private) void |
v2scale(double[] v,
double newLen)
scale v[] to be relative to newLen
From V3Scale() in GGVecLib.c
|
private static final Rectangle TEMP_RECT
private static final DirtyRegionContainer TEMP_CONTAINER
private static final Affine3D TEMP_CACHEFILTER_TRANSFORM
private static final RectBounds TEMP_BOUNDS
private static final double EPSILON
private RTTexture tempTexture
private double lastXDelta
private double lastYDelta
private CacheFilter.ScrollCacheState scrollCacheState
private ImageData cachedImageData
private Rectangle cacheBounds
private final Affine2D cachedXform
private double cachedScaleX
private double cachedScaleY
private double cachedRotate
private double cachedX
private double cachedY
private NGNode node
private final Affine2D screenXform
private boolean scaleHint
private boolean rotateHint
private CacheHint cacheHint
private boolean wasUnsupported
private Rectangle computeDirtyRegionForTranslate()
public void setHint(CacheHint cacheHint)
final boolean isScaleHint()
final boolean isRotateHint()
boolean matchesHint(CacheHint cacheHint)
boolean unsupported(double[] xformInfo)
private boolean isXformScrollCacheCapable(double[] xformInfo)
private boolean needToRenderCache(BaseTransform renderXform, double[] xformInfo, float pixelScale)
void updateScreenXform(double[] xformInfo)
public void invalidate()
void imageDataUnref()
void invalidateByTranslation(double translateXDelta, double translateYDelta)
public void dispose()
double[] unmatrix(BaseTransform xform)
void v2combine(double[] v0, double[] v1, double[] result, double scalarA, double scalarB)
double v2dot(double[] v0, double[] v1)
void v2scale(double[] v, double newLen)
double v2length(double[] v)
void render(Graphics g)
ImageData impl_createImageData(FilterContext fctx, Rectangle bounds)
void impl_renderNodeToCache(ImageData cacheData, Rectangle cacheBounds, BaseTransform xform, Rectangle dirtyBounds)
cacheData
- the cachecacheBounds
- cache boundsxform
- transformationdirtyBounds
- null or dirty rectangle to be renderedvoid impl_renderNodeToScreen(java.lang.Object implGraphics)
void impl_renderCacheToScreen(java.lang.Object implGraphics, Filterable implImage, double mxt, double myt)
boolean impl_scrollCacheCapable()
void impl_moveCacheBy(ImageData cachedImageData, double xDelta, double yDelta)
cachedImageData
- cachexDelta
- x-axis deltayDelta
- y-axis deltaRectangle impl_getCacheBounds(Rectangle bounds, BaseTransform xform)
bounds
- rectangle to store bounds toxform
- transformationBaseBounds computeDirtyBounds(BaseBounds region, BaseTransform tx, GeneralTransform3D pvTx)