java.lang.Object | |
↳ | sun.java2d.SurfaceDataProxy |
![]() |
The proxy class encapsulates the logic for managing alternate SurfaceData representations of a primary SurfaceData. The main class will handle tracking the state changes of the primary SurfaceData and updating the associated SurfaceData proxy variants.
Subclasses have 2 main responsibilities:
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SurfaceDataProxy.CountdownTracker |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
UNCACHED | This instance is for cases where a caching implementation determines that a particular source image will never need to be cached - either the source SurfaceData was of an incompatible type, or it was in an UNTRACKABLE state or some other factor is discovered that permanently prevents acceleration or caching. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a SurfaceData proxy manager that attempts to create
and cache a variant copy of the source SurfaceData after
the default threshold number of attempts to copy from the
STABLE source.
| |||||||||||
Create a SurfaceData proxy manager that attempts to create
and cache a variant copy of the source SurfaceData after
the specified threshold number of attempts to copy from
the STABLE source.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked when the display mode has changed.
| |||||||||||
Flush all cached resources as per the FlushableCacheData interface.
| |||||||||||
Actively flushes (drops and invalidates) the cached surface
so that it can be reclaimed quickly.
| |||||||||||
If the subclass is unable to validate or create a cached
SurfaceData then this method will be used to get a
StateTracker object that will indicate when to attempt
to validate the surface again.
| |||||||||||
Sets the valid state to false so that the next time this
proxy is fetched to generate a replacement SurfaceData,
the code in SurfaceData knows to replace the proxy first.
| |||||||||||
Returns true iff this SurfaceData proxy is still valid
and if it has a currently cached replacement that is also
valid and current.
| |||||||||||
Determine if an alternate form for the srcData is needed
and appropriate from the given operational parameters.
| |||||||||||
Returns true iff this SurfaceData proxy is still the best
way to control caching of the given source on the given
destination.
| |||||||||||
Invoked when the palette has changed.
| |||||||||||
This method attempts to replace the srcData with a cached version.
| |||||||||||
This is the default implementation for updating the cached
SurfaceData from the source (primary) SurfaceData.
| |||||||||||
This is an alternate implementation for updating the cached
SurfaceData from the source (primary) SurfaceData using a
background color for transparent pixels.
| |||||||||||
Construct an alternate form of the given SurfaceData.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method should be called from subclasses which create
cached SurfaceData objects that depend on the current
properties of the display.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
This instance is for cases where a caching implementation determines that a particular source image will never need to be cached - either the source SurfaceData was of an incompatible type, or it was in an UNTRACKABLE state or some other factor is discovered that permanently prevents acceleration or caching. This class optimally implements NOP variants of all necessary methods to avoid caching with a minimum of fuss.
Create a SurfaceData proxy manager that attempts to create and cache a variant copy of the source SurfaceData after the default threshold number of attempts to copy from the STABLE source.
Create a SurfaceData proxy manager that attempts to create and cache a variant copy of the source SurfaceData after the specified threshold number of attempts to copy from the STABLE source.
Invoked when the display mode has changed. This method will invalidate and drop the internal cachedSD object.
Flush all cached resources as per the FlushableCacheData interface. The deaccelerated parameter indicates if the flush is happening because the associated surface is no longer being accelerated (for instance the acceleration priority is set below the threshold needed for acceleration). Returns a boolean that indicates if the cached object is no longer needed and should be removed from the cache.
Actively flushes (drops and invalidates) the cached surface so that it can be reclaimed quickly.
If the subclass is unable to validate or create a cached SurfaceData then this method will be used to get a StateTracker object that will indicate when to attempt to validate the surface again. Subclasses may return trackers which count down an ever increasing threshold to provide hysteresis on creating surfaces during low memory conditions. The default implementation just waits another "threshold" number of accesses before trying again.
Sets the valid state to false so that the next time this proxy is fetched to generate a replacement SurfaceData, the code in SurfaceData knows to replace the proxy first.
Returns true iff this SurfaceData proxy is still valid and if it has a currently cached replacement that is also valid and current.
Determine if an alternate form for the srcData is needed and appropriate from the given operational parameters.
Returns true iff this SurfaceData proxy is still the best way to control caching of the given source on the given destination.
Invoked when the palette has changed.
This method attempts to replace the srcData with a cached version. It relies on the subclass to determine if the cached version will be useful given the operational parameters. This method checks any preexisting cached copy for being "up to date" and tries to update it if it is stale or non-existant and the appropriate number of accesses have occured since it last was stale.
An outline of the process is as follows:
This is the default implementation for updating the cached SurfaceData from the source (primary) SurfaceData. A simple Blit is used to copy the pixels from the source to the destination SurfaceData. A subclass can override this implementation if a more complex operation is required to update its cached copies.
This is an alternate implementation for updating the cached SurfaceData from the source (primary) SurfaceData using a background color for transparent pixels. A simple BlitBg is used to copy the pixels from the source to the destination SurfaceData with the specified bgColor. A subclass can override the normal updateSurfaceData method and call this implementation instead if it wants to use color keying for bitmask images.
Construct an alternate form of the given SurfaceData. The contents of the returned SurfaceData may be undefined since the calling code will take care of updating the contents with a subsequent call to updateSurfaceData.
If the method returns null then there was a problem with allocating the accelerated surface. The getRetryTracker() method will be called to track when to attempt another revalidation.
This method should be called from subclasses which create cached SurfaceData objects that depend on the current properties of the display.