home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-09-28 | 1.2 KB | 44 lines |
- /*
- * QuickTime for Java SDK Sample Code
-
- Usage subject to restrictions in SDK License Agreement
- * Copyright: © 1996-1999 Apple Computer, Inc.
-
- */
- import quicktime.app.actions.*;
- import quicktime.app.anim.*;
- import quicktime.qd.*;
- import quicktime.*;
-
- import java.awt.event.*;
- // we use this to profile the dragging around of Sprites
-
- // this is particular useful if the rate of the compositor is zero
- // and the only rendering work that a compositor does is
- // in response to user interaction - in this case mouseDragging
-
- public class ProfileSWController extends SWController {
- public ProfileSWController (MouseResponder mr, boolean wholespace) throws QTException {
- super (mr, wholespace);
- }
-
-
- int profileCount = 0;
- long startTime, stopTime;
- boolean isProfiling;
-
- public void mouseDragged (MouseEvent e) {
- isProfiling = profileCount++ % 20 == 0;
- if (isProfiling)
- startTime = System.currentTimeMillis();
-
- super.mouseDragged (e);
-
- if (isProfiling) {
- stopTime = System.currentTimeMillis();
- if (((SWCompositor)getSpace()).getTimer().getRate() == 0)
- System.out.println ("mouseDragged:" + (stopTime - startTime) + " msecs");
- }
- }
- }
-