Java Code Examples for java.awt.Image#getAccelerationPriority()

The following examples show how to use java.awt.Image#getAccelerationPriority() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SurfaceData.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 2
Source File: SurfaceData.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 3
Source File: SurfaceData.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 4
Source File: SurfaceData.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 5
Source File: SurfaceData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 6
Source File: SurfaceData.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 7
Source File: SurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 8
Source File: SurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 9
Source File: SurfaceData.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 10
Source File: SurfaceData.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 11
Source File: SurfaceData.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 12
Source File: SurfaceData.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 13
Source File: SurfaceData.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}
 
Example 14
Source File: SurfaceData.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This method is called on a destination SurfaceData to choose
 * the best SurfaceData from a source Image for an imaging
 * operation, with help from its SurfaceManager.
 * The method may determine that the default SurfaceData was
 * really the best choice in the first place, or it may decide
 * to use a cached surface.  Some general decisions about whether
 * acceleration is enabled are made by this method, but any
 * decision based on the type of the source image is made in
 * the makeProxyFor method below when it comes up with the
 * appropriate SurfaceDataProxy instance.
 * The parameters describe the type of imaging operation being performed.
 * <p>
 * If a blitProxyKey was supplied by the subclass then it is
 * used to potentially override the choice of source SurfaceData.
 * The outline of this process is:
 * <ol>
 * <li> Image pipeline asks destSD to find an appropriate
 *      srcSD for a given source Image object.
 * <li> destSD gets the SurfaceManager of the source Image
 *      and first retrieves the default SD from it using
 *      getPrimarySurfaceData()
 * <li> destSD uses its "blit proxy key" (if set) to look for
 *      some cached data stored in the source SurfaceManager
 * <li> If the cached data is null then makeProxyFor() is used
 *      to create some cached data which is stored back in the
 *      source SurfaceManager under the same key for future uses.
 * <li> The cached data will be a SurfaceDataProxy object.
 * <li> The SurfaceDataProxy object is then consulted to
 *      return a replacement SurfaceData object (typically
 *      a cached copy if appropriate, or the original if not).
 * </ol>
 */
public SurfaceData getSourceSurfaceData(Image img,
                                        int txtype,
                                        CompositeType comp,
                                        Color bgColor)
{
    SurfaceManager srcMgr = SurfaceManager.getManager(img);
    SurfaceData srcData = srcMgr.getPrimarySurfaceData();
    if (img.getAccelerationPriority() > 0.0f &&
        blitProxyKey != null)
    {
        SurfaceDataProxy sdp =
            (SurfaceDataProxy) srcMgr.getCacheData(blitProxyKey);
        if (sdp == null || !sdp.isValid()) {
            if (srcData.getState() == State.UNTRACKABLE) {
                sdp = SurfaceDataProxy.UNCACHED;
            } else {
                sdp = makeProxyFor(srcData);
            }
            srcMgr.setCacheData(blitProxyKey, sdp);
        }
        srcData = sdp.replaceData(srcData, txtype, comp, bgColor);
    }
    return srcData;
}