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

pack-priv Class RegionImageCache

extends Object
Class Inheritance
Imports
javafx.scene.layout.Background, java.util.HashMap, com.sun.javafx.geom.Rectangle, .Shape, com.sun.javafx.logging.PulseLogger, com.sun.prism.Graphics, .RTTexture, .ResourceFactory, .Texture.WrapMode, com.sun.prism.impl.packrect.RectanglePacker

RegionImageCache - A fixed pixel count sized cache of Images keyed by arbitrary set of arguments. All images are held with SoftReferences so they will be dropped by the GC if heap memory gets tight. When our size hits max pixel count least recently requested images are removed first.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private RTTexture
private static final int
private RectanglePacker
private HashMap<Integer, RegionImageCache.CachedImage>
private static final int
private RectanglePacker
private static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv RTTexture
pack-priv boolean

Returns:

true means to caller needs to render to rect to initialize the content.
getImageLocation
(Integer
the hash key for the image
key
,
Rectangle
the rect image. On input, width and height determine the requested texture space. On ouput, the x and y the location in the texture
rect
,
Background
the background used to validated if the correct image was found
background
,
Shape
the shape used to validated if the correct image was found
shape
,
Graphics
the graphics to flush if the texture needs to be restarted
g
)

Search the cache for a background image representing the arguments.

pack-priv boolean

Returns:

True if the image size is less than max
isImageCachable
(int
The image width
w
,
int
The image height
h
)

Check if the image size is to big to be stored in the cache

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

backingStoreback to summary
private RTTexture backingStore
HEIGHTback to summary
private static final int HEIGHT
hPackerback to summary
private RectanglePacker hPacker
imageMapback to summary
private HashMap<Integer, RegionImageCache.CachedImage> imageMap
MAX_SIZEback to summary
private static final int MAX_SIZE
vPackerback to summary
private RectanglePacker vPacker
WIDTHback to summary
private static final int WIDTH

Constructor Detail

RegionImageCacheback to summary
pack-priv RegionImageCache(final ResourceFactory factory)

Method Detail

getBackingStoreback to summary
pack-priv RTTexture getBackingStore()
getImageLocationback to summary
pack-priv boolean getImageLocation(Integer key, Rectangle rect, Background background, Shape shape, Graphics g)

Search the cache for a background image representing the arguments. When this method succeeds the x and y coordinates in rect are adjust to the location in the backing store when the image is stored. If a failure occurred the rect is set to empty to indicate the caller to disable caching.

Parameters
key:Integer

the hash key for the image

rect:Rectangle

the rect image. On input, width and height determine the requested texture space. On ouput, the x and y the location in the texture

background:Background

the background used to validated if the correct image was found

shape:Shape

the shape used to validated if the correct image was found

g:Graphics

the graphics to flush if the texture needs to be restarted

Returns:boolean

true means to caller needs to render to rect to initialize the content.

isImageCachableback to summary
pack-priv boolean isImageCachable(int w, int h)

Check if the image size is to big to be stored in the cache

Parameters
w:int

The image width

h:int

The image height

Returns:boolean

True if the image size is less than max

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

pack-priv Class RegionImageCache.CachedImage

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv Background
pack-priv int
pack-priv Shape
pack-priv int
pack-priv int
x

pack-priv int
y

Constructor Summary

AccessConstructor and Description
pack-priv
CachedImage(Rectangle rect, Background background, Shape shape)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(int width, int height, Background background, Shape shape)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

backgroundback to summary
pack-priv Background background
heightback to summary
pack-priv int height
shapeback to summary
pack-priv Shape shape
widthback to summary
pack-priv int width
xback to summary
pack-priv int x
yback to summary
pack-priv int y

Constructor Detail

CachedImageback to summary
pack-priv CachedImage(Rectangle rect, Background background, Shape shape)

Method Detail

equalsback to summary
public boolean equals(int width, int height, Background background, Shape shape)