Package quicktime.qd

Source Code of quicktime.qd.WinNativeGraphics

/*     */ package quicktime.qd;
/*     */
/*     */ import java.util.Enumeration;
/*     */ import java.util.Vector;
/*     */ import quicktime.QTRuntimeException;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.WinJNIDrawingSurface;
/*     */ import sun.awt.DrawingSurfaceInfo;
/*     */ import sun.awt.Win32DrawingSurface;
/*     */
/*     */ final class WinNativeGraphics extends NativeGraphics
/*     */ {
/*  29 */   private static Vector hWndVector = new Vector();
/*     */   private static final boolean debug = false;
/* 134 */   int hWnd = 0;
/*     */
/*     */   private static final void _destroyPorts()
/*     */   {
/*  39 */     Enumeration localEnumeration = hWndVector.elements();
/*  40 */     while (localEnumeration.hasMoreElements()) {
/*  41 */       Object localObject = localEnumeration.nextElement();
/*     */
/*  43 */       DestroyPortAssociation(GetNativeWindowPort(((Integer)localObject).intValue()));
/*     */     }
/*  45 */     hWndVector.removeAllElements();
/*     */   }
/*     */
/*     */   WinNativeGraphics(int paramInt)
/*     */   {
/*  57 */     super((Object)null);
/*  58 */     this.hWnd = paramInt;
/*  59 */     createAssociation();
/*     */   }
/*     */
/*     */   WinNativeGraphics(WinJNIDrawingSurface paramWinJNIDrawingSurface)
/*     */   {
/*  66 */     super(paramWinJNIDrawingSurface);
/*  67 */     if (QTSession.getJavaVersion() >= 65540) {
/*  68 */       this.jnidrawingsurfaceinfo.lock();
/*     */
/*  71 */       this.hWnd = this.jnidrawingsurfaceinfo.getHWnd();
/*  72 */       this.jnidrawingsurfaceinfo.unlock();
/*     */     }
/*  74 */     createAssociation();
/*     */   }
/*     */
/*     */   WinNativeGraphics(DrawingSurfaceInfo paramDrawingSurfaceInfo)
/*     */   {
/*  83 */     super(paramDrawingSurfaceInfo);
/*     */
/*  85 */     Win32DrawingSurface localWin32DrawingSurface = (Win32DrawingSurface)this.dsi.getSurface();
/*  86 */     this.dsi.lock();
/*  87 */     this.hWnd = localWin32DrawingSurface.getHWnd();
/*  88 */     this.dsi.unlock();
/*  89 */     createAssociation();
/*     */   }
/*     */
/*     */   private void createAssociation()
/*     */   {
/* 112 */     int i = 0;
/* 113 */     for (int j = 0; j < hWndVector.size(); j++) {
/* 114 */       if (((Integer)hWndVector.elementAt(j)).intValue() == this.hWnd) {
/* 115 */         i = 1;
/* 116 */         break;
/*     */       }
/*     */
/*     */     }
/*     */
/* 121 */     if (i == 0)
/*     */     {
/* 125 */       j = CreatePortAssociation(this.hWnd, 0, 2);
/* 126 */       if (j == 0) throw new QTRuntimeException("No Port for HWnd");
/* 127 */       hWndVector.addElement(new Integer(this.hWnd));
/*     */     }
/*     */   }
/*     */
/*     */   public final QDGraphics getGWorld()
/*     */     throws NativeGraphicsException
/*     */   {
/* 139 */     return QDGraphics.fromNativeGraphics(this);
/*     */   }
/*     */
/*     */   private void removeContext()
/*     */   {
/* 150 */     if (this.hWnd != 0) {
/* 151 */       if (hWndVector.isEmpty()) {
/* 152 */         this.hWnd = 0;
/* 153 */         return;
/*     */       }
/*     */
/* 156 */       for (int i = 0; i < hWndVector.size(); i++) {
/* 157 */         if (((Integer)hWndVector.elementAt(i)).intValue() == this.hWnd) {
/* 158 */           hWndVector.removeElementAt(i);
/* 159 */           DestroyPortAssociation(GetNativeWindowPort(this.hWnd));
/* 160 */           break;
/*     */         }
/*     */       }
/* 163 */       this.hWnd = 0;
/*     */     }
/*     */   }
/*     */
/*     */   int _getWindow()
/*     */     throws NativeGraphicsException
/*     */   {
/* 178 */     return 0;
/*     */   }
/*     */
/*     */   protected void finalize() throws Throwable
/*     */   {
/* 183 */     removeContext();
/* 184 */     super.finalize();
/*     */   }
/*     */
/*     */   public String toString()
/*     */   {
/* 193 */     return getClass().getName() + "[vector=" + hWndVector + ",hWnd=" + this.hWnd + "]";
/*     */   }
/*     */
/*     */   private static native void DestroyPortAssociation(int paramInt);
/*     */
/*     */   private static native int GetNativeWindowPort(int paramInt);
/*     */
/*     */   private static native int CreatePortAssociation(int paramInt1, int paramInt2, int paramInt3);
/*     */ }

/* Location:           Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name:     quicktime.qd.WinNativeGraphics
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.qd.WinNativeGraphics

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.