当前位置: 首页>>代码示例>>Java>>正文


Java SunToolkit.awtLock方法代码示例

本文整理汇总了Java中sun.awt.SunToolkit.awtLock方法的典型用法代码示例。如果您正苦于以下问题:Java SunToolkit.awtLock方法的具体用法?Java SunToolkit.awtLock怎么用?Java SunToolkit.awtLock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.awt.SunToolkit的用法示例。


在下文中一共展示了SunToolkit.awtLock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawLine

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
    Region compClip = sg2d.getCompClip();
    int transX1 = Region.clipAdd(x1, sg2d.transX);
    int transY1 = Region.clipAdd(y1, sg2d.transY);
    int transX2 = Region.clipAdd(x2, sg2d.transX);
    int transY2 = Region.clipAdd(y2, sg2d.transY);

    SunToolkit.awtLock();
    try {
        validateSurface(sg2d);
        lineGen.rasterizeLine(rectBuffer, transX1, transY1,
                transX2, transY2, compClip.getLoX(), compClip.getLoY(),
                compClip.getHiX(), compClip.getHiY(), true, true);
        tileManager.fillMask((XRSurfaceData) sg2d.surfaceData);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:XRRenderer.java

示例2: Blit

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void Blit(SurfaceData src, SurfaceData dst,
                 Composite comp, Region clip,
                 int sx, int sy,
                 int dx, int dy,
                 int w, int h)
{
    SunToolkit.awtLock();
    try {
        X11SurfaceData x11sd = (X11SurfaceData)dst;
        // pass null clip region here since we clip manually in native code
        // also use false for needExposures since we clip to the pixmap
        long xgc = x11sd.getBlitGC(null, false);
        nativeBlit(src.getNativeOps(), dst.getNativeOps(), xgc, clip,
                   sx, sy, dx, dy, w, h);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:X11PMBlitLoops.java

示例3: lock

import sun.awt.SunToolkit; //导入方法依赖的package包/类
/**
 * Locks the queue for read/write access.
 */
public final void lock() {
    /*
     * Implementation note: In theory we should have two separate locks:
     * one lock to synchronize access to the RenderQueue, and then a
     * separate lock (the AWT lock) that only needs to be acquired when
     * we are about to flush the queue (using native windowing system
     * operations).  In practice it has been difficult to enforce the
     * correct lock ordering; sometimes AWT will have already acquired
     * the AWT lock before grabbing the RQ lock (see 6253009), while the
     * expected order should be RQ lock and then AWT lock.  Due to this
     * issue, using two separate locks is prone to deadlocks.  Therefore,
     * to solve this issue we have decided to eliminate the separate RQ
     * lock and instead just acquire the AWT lock here.  (Someday it might
     * be nice to go back to the old two-lock system, but that would
     * require potentially risky changes to AWT to ensure that it never
     * acquires the AWT lock before calling into 2D code that wants to
     * acquire the RQ lock.)
     */
    SunToolkit.awtLock();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:RenderQueue.java

示例4: fillSpans

import sun.awt.SunToolkit; //导入方法依赖的package包/类
protected void fillSpans(SunGraphics2D sg2d, SpanIterator si,
                         int transx, int transy) {
    SunToolkit.awtLock();
    try {
        validateSurface(sg2d);
        int[] spanBox = new int[4];
        while (si.nextSpan(spanBox)) {
            rectBuffer.pushRectValues(spanBox[0] + transx,
                                spanBox[1] + transy,
                                spanBox[2] - spanBox[0],
                                spanBox[3] - spanBox[1]);
        }
        tileManager.fillMask(((XRSurfaceData) sg2d.surfaceData));
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:XRRenderer.java

示例5: Blit

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) {
    try {
        SunToolkit.awtLock();

        XRSurfaceData x11sdDst = (XRSurfaceData) dst;
        x11sdDst.validateAsDestination(null, clip);
        XRSurfaceData x11sdSrc = (XRSurfaceData) src;
        x11sdSrc.validateAsSource(null, XRUtils.RepeatNone, XRUtils.FAST);

        x11sdDst.maskBuffer.validateCompositeState(comp, null, null, null);

        x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, sx, sy, dx, dy, w, h);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:XRPMBlitLoops.java

示例6: BlitBg

import sun.awt.SunToolkit; //导入方法依赖的package包/类
@Override
public void BlitBg(SurfaceData src, SurfaceData dst,
                   Composite comp, Region clip, int bgColor,
                   int sx, int sy,
                   int dx, int dy,
                   int w, int h)
{
    SunToolkit.awtLock();
    try {
        int pixel = dst.pixelFor(bgColor);
        X11SurfaceData x11sd = (X11SurfaceData)dst;
        // use false for needExposures since we clip to the pixmap
        long xgc = x11sd.getBlitGC(clip, false);
        nativeBlitBg(src.getNativeOps(), dst.getNativeOps(),
                     xgc, pixel,
                     sx, sy, dx, dy, w, h);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:X11PMBlitBgLoops.java

示例7: copyArea

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public boolean copyArea(SunGraphics2D sg2d,
                        int x, int y, int w, int h, int dx, int dy)
{
    if (x11pipe == null) {
        if (!isDrawableValid()) {
            return true;
        }
        makePipes();
    }
    CompositeType comptype = sg2d.imageComp;
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
        (CompositeType.SrcOverNoEa.equals(comptype) ||
         CompositeType.SrcNoEa.equals(comptype)))
    {
        x += sg2d.transX;
        y += sg2d.transY;
        SunToolkit.awtLock();
        try {
            boolean needExposures = canSourceSendExposures(x, y, w, h);
            long xgc = getBlitGC(sg2d.getCompClip(), needExposures);
            x11pipe.devCopyArea(getNativeOps(), xgc,
                                x, y,
                                x + dx, y + dy,
                                w, h);
        } finally {
            SunToolkit.awtUnlock();
        }
        return true;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:X11SurfaceData.java

示例8: drawOval

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void drawOval(SunGraphics2D sg2d,
                     int x, int y, int width, int height)
{
    SunToolkit.awtLock();
    try {
        long xgc = validate(sg2d);
        XDrawOval(sg2d.surfaceData.getNativeOps(), xgc,
                  x+sg2d.transX, y+sg2d.transY, width, height);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:X11Renderer.java

示例9: fillArc

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void fillArc(SunGraphics2D sg2d,
                    int x, int y, int width, int height,
                    int startAngle, int arcAngle)
{
    SunToolkit.awtLock();
    try {
        long xgc = validate(sg2d);
        XFillArc(sg2d.surfaceData.getNativeOps(), xgc,
                 x+sg2d.transX, y+sg2d.transY, width, height,
                 startAngle, arcAngle);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:X11Renderer.java

示例10: XSync

import sun.awt.SunToolkit; //导入方法依赖的package包/类
private static void XSync() {
    SunToolkit.awtLock();
    try {
        XlibWrapper.XSync(display, 0);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:XErrorHandlerUtil.java

示例11: drawGlyphList

import sun.awt.SunToolkit; //导入方法依赖的package包/类
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
    SunToolkit.awtLock();
    try {
        X11SurfaceData x11sd = (X11SurfaceData)sg2d.surfaceData;
        Region clip = sg2d.getCompClip();
        long xgc = x11sd.getRenderGC(clip, SunGraphics2D.COMP_ISCOPY,
                                     null, sg2d.pixel);
        doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:X11TextRenderer.java

示例12: fillRoundRect

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void fillRoundRect(SunGraphics2D sg2d,
                          int x, int y, int width, int height,
                          int arcWidth, int arcHeight)
{
    SunToolkit.awtLock();
    try {
        long xgc = validate(sg2d);
        XFillRoundRect(sg2d.surfaceData.getNativeOps(), xgc,
                       x+sg2d.transX, y+sg2d.transY, width, height,
                       arcWidth, arcHeight);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:X11Renderer.java

示例13: drawRoundRect

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void drawRoundRect(SunGraphics2D sg2d,
                          int x, int y, int width, int height,
                          int arcWidth, int arcHeight)
{
    SunToolkit.awtLock();
    try {
        long xgc = validate(sg2d);
        XDrawRoundRect(sg2d.surfaceData.getNativeOps(), xgc,
                       x+sg2d.transX, y+sg2d.transY, width, height,
                       arcWidth, arcHeight);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:X11Renderer.java

示例14: fillRect

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void fillRect(SunGraphics2D sg2d,
                     int x, int y, int width, int height)
{
    SunToolkit.awtLock();
    try {
        long xgc = validate(sg2d);
        XFillRect(sg2d.surfaceData.getNativeOps(), xgc,
                  x+sg2d.transX, y+sg2d.transY, width, height);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:X11Renderer.java

示例15: preInit

import sun.awt.SunToolkit; //导入方法依赖的package包/类
void preInit(XCreateWindowParams params) {
    target = (Component)params.get(TARGET);
    windowType = ((Window)target).getType();
    params.put(REPARENTED,
               Boolean.valueOf(isOverrideRedirect() || isSimpleWindow()));
    super.preInit(params);
    params.putIfNull(BIT_GRAVITY, Integer.valueOf(XConstants.NorthWestGravity));

    long eventMask = 0;
    if (params.containsKey(EVENT_MASK)) {
        eventMask = ((Long)params.get(EVENT_MASK));
    }
    eventMask |= XConstants.VisibilityChangeMask;
    params.put(EVENT_MASK, eventMask);

    XA_NET_WM_STATE = XAtom.get("_NET_WM_STATE");


    params.put(OVERRIDE_REDIRECT, Boolean.valueOf(isOverrideRedirect()));

    SunToolkit.awtLock();
    try {
        windows.add(this);
    } finally {
        SunToolkit.awtUnlock();
    }

    cachedFocusableWindow = isFocusableWindow();

    Font f = target.getFont();
    if (f == null) {
        f = XWindow.getDefaultFont();
        target.setFont(f);
        // we should not call setFont because it will call a repaint
        // which the peer may not be ready to do yet.
    }
    Color c = target.getBackground();
    if (c == null) {
        Color background = SystemColor.window;
        target.setBackground(background);
        // we should not call setBackGround because it will call a repaint
        // which the peer may not be ready to do yet.
    }
    c = target.getForeground();
    if (c == null) {
        target.setForeground(SystemColor.windowText);
        // we should not call setForeGround because it will call a repaint
        // which the peer may not be ready to do yet.
    }

    alwaysOnTop = ((Window)target).isAlwaysOnTop() && ((Window)target).isAlwaysOnTopSupported();

    GraphicsConfiguration gc = getGraphicsConfiguration();
    ((X11GraphicsDevice)gc.getDevice()).addDisplayChangedListener(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:56,代码来源:XWindowPeer.java


注:本文中的sun.awt.SunToolkit.awtLock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。