jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
changeset 23272 0e0103e73d3c
parent 11271 f10f98b24801
child 23328 4c53a6ebc779
equal deleted inserted replaced
23271:99648f1e831a 23272:0e0103e73d3c
     1 /*
     1 /*
     2  * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    31 import java.awt.Image;
    31 import java.awt.Image;
    32 import java.awt.Window;
    32 import java.awt.Window;
    33 import java.awt.image.BufferedImage;
    33 import java.awt.image.BufferedImage;
    34 import java.awt.image.DataBufferInt;
    34 import java.awt.image.DataBufferInt;
    35 import java.awt.image.VolatileImage;
    35 import java.awt.image.VolatileImage;
    36 import java.lang.ref.WeakReference;
       
    37 import java.security.AccessController;
    36 import java.security.AccessController;
    38 import sun.awt.image.BufImgSurfaceData;
    37 import sun.awt.image.BufImgSurfaceData;
    39 import sun.java2d.DestSurfaceProvider;
    38 import sun.java2d.DestSurfaceProvider;
    40 import sun.java2d.InvalidPipeException;
    39 import sun.java2d.InvalidPipeException;
    41 import sun.java2d.Surface;
    40 import sun.java2d.Surface;
    44 import sun.java2d.pipe.hw.AccelGraphicsConfig;
    43 import sun.java2d.pipe.hw.AccelGraphicsConfig;
    45 import sun.java2d.pipe.hw.AccelSurface;
    44 import sun.java2d.pipe.hw.AccelSurface;
    46 import sun.security.action.GetPropertyAction;
    45 import sun.security.action.GetPropertyAction;
    47 
    46 
    48 import static java.awt.image.VolatileImage.*;
    47 import static java.awt.image.VolatileImage.*;
    49 import static java.awt.Transparency.*;
       
    50 import static sun.java2d.pipe.hw.AccelSurface.*;
    48 import static sun.java2d.pipe.hw.AccelSurface.*;
    51 import static sun.java2d.pipe.hw.ContextCapabilities.*;
    49 import static sun.java2d.pipe.hw.ContextCapabilities.*;
    52 
    50 
    53 /**
    51 /**
    54  * This class handles the updates of the non-opaque windows.
    52  * This class handles the updates of the non-opaque windows.
    57  * the window.
    55  * the window.
    58  *
    56  *
    59  * Note: this class does not attempt to be thread safe, it is expected to be
    57  * Note: this class does not attempt to be thread safe, it is expected to be
    60  * called from a single thread (EDT).
    58  * called from a single thread (EDT).
    61  */
    59  */
    62 public abstract class TranslucentWindowPainter {
    60 abstract class TranslucentWindowPainter {
    63 
    61 
    64     protected Window window;
    62     protected Window window;
    65     protected WWindowPeer peer;
    63     protected WWindowPeer peer;
    66 
    64 
    67     // REMIND: we probably would want to remove this later
    65     // REMIND: we probably would want to remove this later
   229             peer.updateWindowImpl(data, bi.getWidth(), bi.getHeight());
   227             peer.updateWindowImpl(data, bi.getWidth(), bi.getHeight());
   230 
   228 
   231             return (viBB != null ? !viBB.contentsLost() : true);
   229             return (viBB != null ? !viBB.contentsLost() : true);
   232         }
   230         }
   233 
   231 
       
   232         @Override
   234         public void flush() {
   233         public void flush() {
   235             if (backBuffer != null) {
   234             if (backBuffer != null) {
   236                 backBuffer.flush();
   235                 backBuffer.flush();
   237                 backBuffer = null;
   236                 backBuffer = null;
   238             }
   237             }
   311                     RenderQueue rq = as.getContext().getRenderQueue();
   310                     RenderQueue rq = as.getContext().getRenderQueue();
   312                     rq.lock();
   311                     rq.lock();
   313                     try {
   312                     try {
   314                         BufferedContext.validateContext(as);
   313                         BufferedContext.validateContext(as);
   315                         rq.flushAndInvokeNow(new Runnable() {
   314                         rq.flushAndInvokeNow(new Runnable() {
       
   315                             @Override
   316                             public void run() {
   316                             public void run() {
   317                                 long psdops = as.getNativeOps();
   317                                 long psdops = as.getNativeOps();
   318                                 arr[0] = updateWindowAccel(psdops, w, h);
   318                                 arr[0] = updateWindowAccel(psdops, w, h);
   319                             }
   319                             }
   320                         });
   320                         });