APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.javafx.sg.prism

public Class CacheFilter

extends Object
Class Inheritance
Imports
com.sun.javafx.logging.PulseLogger, javafx.scene.CacheHint, java.util.List, com.sun.javafx.geom.BaseBounds, .DirtyRegionContainer, .RectBounds, .Rectangle, com.sun.javafx.geom.transform.Affine2D, .Affine3D, .BaseTransform, .GeneralTransform3D, com.sun.prism.Graphics, .RTTexture, .Texture, com.sun.scenario.effect.Effect, .FilterContext, .Filterable, .ImageData, com.sun.scenario.effect.impl.prism.PrDrawable, .PrFilterContext, javafx.geometry.Insets, javafx.scene.layout.Background, .BackgroundFill, javafx.scene.paint.Color

Base implementation of the Node.cache and cacheHint APIs. When all or a portion of the cacheHint becomes enabled, we should try *not* to re-render the cache. This avoids a big hiccup at the beginning of the "use SPEED only while animating" use case: 0) Under DEFAULT, we should already have a cached image 1) scale/rotate caching is enabled (no expensive re-render required) 2) animation happens, using the cached image 3) animation completes, caching is disable and the node is re-rendered (at full-fidelity) with the final transform. Certain transform combinations are not supported, notably scaling by unequal amounts in the x and y directions while also rotating. Other than simple translation, animations in this case will require re-rendering every frame. Ideally, a simple change to a Node's translation should never regenerate the cached image. The CacheFilter is also capable of optimizing the scrolling of the cached contents. For example, the ScrollView UI Control can define its content area as being cached, such that when the user scrolls, we can shift the old content area and adjust the dirty region so that it only includes the "newly exposed" area.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
CacheFilter.ScrollCacheState

Defines the state when we're in the midst of scrolling a cached image

Field Summary

Modifier and TypeField and Description
private Rectangle
private ImageData
private double
private double
private double
private double
private final Affine2D
private double
private CacheHint
private static final double
private double
private double
private NGNode
private boolean
private boolean
private final Affine2D
private CacheFilter.ScrollCacheState
private static final RectBounds
private static final Affine3D
private static final DirtyRegionContainer
private static final Rectangle
private RTTexture
private boolean

Constructor Summary

AccessConstructor and Description
protected
CacheFilter(NGNode node, CacheHint cacheHint)

Method Summary

Modifier and TypeMethod and Description
pack-priv BaseBounds
private Rectangle
computeDirtyRegionForTranslate()

Compute the dirty region that must be re-rendered after scrolling

pack-priv ImageData
createImageData(FilterContext fctx, Rectangle bounds)

Create the ImageData for the cached bitmap, with the specified bounds.

public void
pack-priv Rectangle
getCacheBounds(Rectangle
rectangle to store bounds to
bounds
,
BaseTransform
transformation
xform
)

Get the cache bounds.

pack-priv void
public void
pack-priv void
invalidateByTranslation(double translateXDelta, double translateYDelta)

pack-priv final boolean
pack-priv final boolean
private boolean
isXformScrollCacheCapable(double[] xformInfo)

pack-priv boolean
matchesHint(CacheHint cacheHint)

Indicates whether this CacheFilter's hint matches the CacheHint passed in.

pack-priv void
moveCacheBy(ImageData
cache
cachedImageData
,
double
x-axis delta
xDelta
,
double
y-axis delta
yDelta
)

Moves a subregion of the cache, "scrolling" the cache by x/y Delta.

private boolean
needToRenderCache(BaseTransform renderXform, double[] xformInfo, float pixelScaleX, float pixelScaleY)

pack-priv void
pack-priv void
renderCacheToScreen(Object implGraphics, Filterable implImage, double mxt, double myt)

Render the cached image to the screen, translated by mxt, myt.

pack-priv void
renderNodeToCache(ImageData
the cache
cacheData
,
Rectangle
cache bounds
cacheBounds
,
BaseTransform
transformation
xform
,
Rectangle
null or dirty rectangle to be rendered
dirtyBounds
)

Render node to cache.

pack-priv void
renderNodeToScreen(Object implGraphics)

Render the node directly to the screen, in the case that the cached image is unexpectedly null.

pack-priv boolean
scrollCacheCapable()

True if we can use scrolling optimization on this node.

public void
setHint(CacheHint cacheHint)

pack-priv double

Returns:

-1.0 if the matrix element is negative, otherwise 1.0
unitDir
(double
the matrix element representing a scale factor
v
)

Return the unit distance in a direction compatible with the matrix element.

pack-priv double[]
unmatrix(BaseTransform xform)

Given a BaseTransform, decompose it into values for scaleX, scaleY and rotate.

pack-priv boolean
unsupported(double[] xformInfo)

Are we attempting to use cache for an unsupported transform mode?

pack-priv void
updateScreenXform(double[] xformInfo)

pack-priv 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

pack-priv double
v2dot(double[] v0, double[] v1)

dot product of 2 vectors of length 2

pack-priv double
v2length(double[] v)

returns length of input vector Based on V3Length() in GGVecLib.c

pack-priv void
v2scale(double[] v, double newLen)

scale v[] to be relative to newLen From V3Scale() in GGVecLib.c

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheBoundsback to summary
private Rectangle cacheBounds
cachedImageDataback to summary
private ImageData cachedImageData
cachedRotateback to summary
private double cachedRotate
cachedScaleXback to summary
private double cachedScaleX
cachedScaleYback to summary
private double cachedScaleY
cachedXback to summary
private double cachedX
cachedXformback to summary
private final Affine2D cachedXform
cachedYback to summary
private double cachedY
cacheHintback to summary
private CacheHint cacheHint
EPSILONback to summary
private static final double EPSILON
lastXDeltaback to summary
private double lastXDelta
lastYDeltaback to summary
private double lastYDelta
nodeback to summary
private NGNode node
rotateHintback to summary
private boolean rotateHint
scaleHintback to summary
private boolean scaleHint
screenXformback to summary
private final Affine2D screenXform
scrollCacheStateback to summary
private CacheFilter.ScrollCacheState scrollCacheState
TEMP_BOUNDSback to summary
private static final RectBounds TEMP_BOUNDS
TEMP_CACHEFILTER_TRANSFORMback to summary
private static final Affine3D TEMP_CACHEFILTER_TRANSFORM
TEMP_CONTAINERback to summary
private static final DirtyRegionContainer TEMP_CONTAINER
TEMP_RECTback to summary
private static final Rectangle TEMP_RECT
tempTextureback to summary
private RTTexture tempTexture
wasUnsupportedback to summary
private boolean wasUnsupported

Constructor Detail

CacheFilterback to summary
protected CacheFilter(NGNode node, CacheHint cacheHint)

Method Detail

computeDirtyBoundsback to summary
pack-priv BaseBounds computeDirtyBounds(BaseBounds region, BaseTransform tx, GeneralTransform3D pvTx)
computeDirtyRegionForTranslateback to summary
private Rectangle computeDirtyRegionForTranslate()

Compute the dirty region that must be re-rendered after scrolling

createImageDataback to summary
pack-priv ImageData createImageData(FilterContext fctx, Rectangle bounds)

Create the ImageData for the cached bitmap, with the specified bounds.

disposeback to summary
public void dispose()
getCacheBoundsback to summary
pack-priv Rectangle getCacheBounds(Rectangle bounds, BaseTransform xform)

Get the cache bounds.

Parameters
bounds:Rectangle

rectangle to store bounds to

xform:BaseTransform

transformation

imageDataUnrefback to summary
pack-priv void imageDataUnref()
invalidateback to summary
public void invalidate()
invalidateByTranslationback to summary
pack-priv void invalidateByTranslation(double translateXDelta, double translateYDelta)
isRotateHintback to summary
pack-priv final boolean isRotateHint()
isScaleHintback to summary
pack-priv final boolean isScaleHint()
isXformScrollCacheCapableback to summary
private boolean isXformScrollCacheCapable(double[] xformInfo)
matchesHintback to summary
pack-priv boolean matchesHint(CacheHint cacheHint)

Indicates whether this CacheFilter's hint matches the CacheHint passed in.

moveCacheByback to summary
pack-priv void moveCacheBy(ImageData cachedImageData, double xDelta, double yDelta)

Moves a subregion of the cache, "scrolling" the cache by x/y Delta. On of xDelta/yDelta must be zero. The rest of the pixels will be cleared.

Parameters
cachedImageData:ImageData

cache

xDelta:double

x-axis delta

yDelta:double

y-axis delta

needToRenderCacheback to summary
private boolean needToRenderCache(BaseTransform renderXform, double[] xformInfo, float pixelScaleX, float pixelScaleY)
renderback to summary
pack-priv void render(Graphics g)
renderCacheToScreenback to summary
pack-priv void renderCacheToScreen(Object implGraphics, Filterable implImage, double mxt, double myt)

Render the cached image to the screen, translated by mxt, myt.

renderNodeToCacheback to summary
pack-priv void renderNodeToCache(ImageData cacheData, Rectangle cacheBounds, BaseTransform xform, Rectangle dirtyBounds)

Render node to cache.

Parameters
cacheData:ImageData

the cache

cacheBounds:Rectangle

cache bounds

xform:BaseTransform

transformation

dirtyBounds:Rectangle

null or dirty rectangle to be rendered

renderNodeToScreenback to summary
pack-priv void renderNodeToScreen(Object implGraphics)

Render the node directly to the screen, in the case that the cached image is unexpectedly null. See JDK-8108473.

scrollCacheCapableback to summary
pack-priv boolean scrollCacheCapable()

True if we can use scrolling optimization on this node.

setHintback to summary
public void setHint(CacheHint cacheHint)
unitDirback to summary
pack-priv double unitDir(double v)

Return the unit distance in a direction compatible with the matrix element.

Parameters
v:double

the matrix element representing a scale factor

Returns:double

-1.0 if the matrix element is negative, otherwise 1.0

unmatrixback to summary
pack-priv double[] unmatrix(BaseTransform xform)

Given a BaseTransform, decompose it into values for scaleX, scaleY and rotate. The return value is a double[3], the values being: [0]: scaleX [1]: scaleY [2]: rotation angle, in radians, between *** and *** From unmatrix() in unmatrix.c

unsupportedback to summary
pack-priv 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).

updateScreenXformback to summary
pack-priv void updateScreenXform(double[] xformInfo)
v2combineback to summary
pack-priv 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

v2dotback to summary
pack-priv double v2dot(double[] v0, double[] v1)

dot product of 2 vectors of length 2

v2lengthback to summary
pack-priv double v2length(double[] v)

returns length of input vector Based on V3Length() in GGVecLib.c

v2scaleback to summary
pack-priv void v2scale(double[] v, double newLen)

scale v[] to be relative to newLen From V3Scale() in GGVecLib.c

com.sun.javafx.sg.prism back to summary

private final Enum CacheFilter.ScrollCacheState

extends Enum<CacheFilter.ScrollCacheState>
Class Inheritance

Defines the state when we're in the midst of scrolling a cached image

Field Summary

Modifier and TypeField and Description
public static final CacheFilter.ScrollCacheState
public static final CacheFilter.ScrollCacheState
public static final CacheFilter.ScrollCacheState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static CacheFilter.ScrollCacheState
public static CacheFilter.ScrollCacheState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CHECKING_PRECONDITIONSback to summary
public static final CacheFilter.ScrollCacheState CHECKING_PRECONDITIONS
DISABLEDback to summary
public static final CacheFilter.ScrollCacheState DISABLED
ENABLEDback to summary
public static final CacheFilter.ScrollCacheState ENABLED

Constructor Detail

ScrollCacheStateback to summary
private ScrollCacheState()

Method Detail

valueOfback to summary
public static CacheFilter.ScrollCacheState valueOf(String name)
valuesback to summary
public static CacheFilter.ScrollCacheState[] values()