~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ikvm/openjdk/sun/java2d/SunGraphicsEnvironment.java

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2009, 2011 Volker Berlin (i-net software)
 
3
 
 
4
  This software is provided 'as-is', without any express or implied
 
5
  warranty.  In no event will the authors be held liable for any damages
 
6
  arising from the use of this software.
 
7
 
 
8
  Permission is granted to anyone to use this software for any purpose,
 
9
  including commercial applications, and to alter it and redistribute it
 
10
  freely, subject to the following restrictions:
 
11
 
 
12
  1. The origin of this software must not be misrepresented; you must not
 
13
     claim that you wrote the original software. If you use this software
 
14
     in a product, an acknowledgment in the product documentation would be
 
15
     appreciated but is not required.
 
16
  2. Altered source versions must be plainly marked as such, and must not be
 
17
     misrepresented as being the original software.
 
18
  3. This notice may not be removed or altered from any source distribution.
 
19
 
 
20
  Jeroen Frijters
 
21
  jeroen@frijters.net
 
22
  
 
23
 */
 
24
package sun.java2d;
 
25
 
 
26
import java.awt.GraphicsConfiguration;
 
27
import java.awt.GraphicsDevice;
 
28
import java.awt.GraphicsEnvironment;
 
29
import java.awt.Insets;
 
30
import java.awt.peer.ComponentPeer;
 
31
import java.awt.Rectangle;
 
32
import java.awt.Toolkit;
 
33
 
 
34
import sun.awt.DisplayChangedListener;
 
35
import sun.awt.SunDisplayChanger;
 
36
 
 
37
 
 
38
 
 
39
/**
 
40
 * A replacement of the Sun implementation that will extends from from NetGraphicsEnvironment
 
41
 */
 
42
public abstract class SunGraphicsEnvironment extends GraphicsEnvironment{
 
43
 
 
44
    /**
 
45
     * Return the bounds of a GraphicsDevice, less its screen insets.
 
46
     * See also java.awt.GraphicsEnvironment.getUsableBounds();
 
47
     */
 
48
    public static Rectangle getUsableBounds(GraphicsDevice gd) {
 
49
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
 
50
        Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
 
51
        Rectangle usableBounds = gc.getBounds();
 
52
 
 
53
        usableBounds.x += insets.left;
 
54
        usableBounds.y += insets.top;
 
55
        usableBounds.width -= (insets.left + insets.right);
 
56
        usableBounds.height -= (insets.top + insets.bottom);
 
57
 
 
58
        return usableBounds;
 
59
    }
 
60
 
 
61
    /**
 
62
     * Returns true when the display is local, false for remote displays.
 
63
     *
 
64
     * @return true when the display is local, false for remote displays
 
65
     */
 
66
    public abstract boolean isDisplayLocal();
 
67
 
 
68
    /*
 
69
     * ----DISPLAY CHANGE SUPPORT----
 
70
     */
 
71
 
 
72
    protected SunDisplayChanger displayChanger = new SunDisplayChanger();
 
73
 
 
74
    /**
 
75
     * Add a DisplayChangeListener to be notified when the display settings
 
76
     * are changed.
 
77
     */
 
78
    public void addDisplayChangedListener(DisplayChangedListener client) {
 
79
        displayChanger.add(client);
 
80
    }
 
81
 
 
82
    /**
 
83
     * Remove a DisplayChangeListener from Win32GraphicsEnvironment
 
84
     */
 
85
    public void removeDisplayChangedListener(DisplayChangedListener client) {
 
86
        displayChanger.remove(client);
 
87
    }
 
88
 
 
89
    /*
 
90
     * ----END DISPLAY CHANGE SUPPORT----
 
91
     */
 
92
 
 
93
    /**
 
94
     * Returns true if FlipBufferStrategy with COPIED buffer contents
 
95
     * is preferred for this peer's GraphicsConfiguration over
 
96
     * BlitBufferStrategy, false otherwise.
 
97
     *
 
98
     * The reason FlipBS could be preferred is that in some configurations
 
99
     * an accelerated copy to the screen is supported (like Direct3D 9)
 
100
     *
 
101
     * @return true if flip strategy should be used, false otherwise
 
102
     */
 
103
    public boolean isFlipStrategyPreferred(ComponentPeer peer) {
 
104
        return false;
 
105
    }
 
106
}