JDK-8015100 : [macosx] Applet graphics corrupted when applet width/height exceeds screen dimensions
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2013-03-20
  • Updated: 2014-11-17
  • Resolved: 2014-02-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b06Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version  " 1.7.0_10 " 
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin New-Users-MacBook-Pro.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64

MacOS 10.7.5

EXTRA RELEVANT SYSTEM CONFIGURATION :
Mid-2009 Macbook Pro with 1440x900 display, and no external monitors

A DESCRIPTION OF THE PROBLEM :
When an applet is embedded in an HTML page, and the applet's width and height parameters are set to exceed the resolution of the display (e.g. you set width and height to 10000), then the applet displays gibberish instead of the expected UI or graphics.

This has been tested and verified on Safari 6.0.2 and Firefox 18 on MacOS 10.7.5 and 10.8.2.

This error does not occur in the Applet Viewer when the applet viewer is sized similarly. So, it seems to be only a browser/plugin-related painting problem.

REGRESSION.  Last worked in version 6u31

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use the attached code sample. Create an HTML page that includes the applet, and whose width and height exceed the resolution of your display (as shown in the source comments). Observe that the applet displays garbage instead of the expected behaviour.

The expected behaviour is a square sliding from left to right.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The applet should paint normally.
ACTUAL -
The applet displays garbage (see http://i.imgur.com/3FnDu.png for an example).

FWIW, the garbage appears to be the height of the applet less the height of the display. So, if:

h = appletHeight;
H = display height;

garbageHeight = h - H;

The applet *does* paint correctly below the garbageHeight.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/*
Use with an HTML file like:

    <!doctype html>
    <applet width= " 5000 "  height= " 5000 "  code= " TestApplet2 "  archive= " applet.jar " ></applet>
 */

public class TestApplet2 extends JApplet {
    Timer drawFrameTimer;

    @Override
    public void init() {
        drawFrameTimer = new Timer(20, new ActionListener() {
            final Graphics2D graphics = (Graphics2D) getGraphics();
            int frame = 1;

            public void actionPerformed(ActionEvent e) {
                final int currentFrame = frame;

                graphics.setColor(Color.white);
                graphics.fillRect(0, 0, getWidth(), getHeight());
                graphics.setColor(Color.black);
                graphics.fillRect(currentFrame, 100, 100, 100);

                frame++;
                if (frame >= getWidth()) {
                    frame = 0;
                }
            }
        });
    }

    @Override
    public void start() {
        drawFrameTimer.start();
    }

    @Override
    public void stop() {
        drawFrameTimer.stop();
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Use an applet height and width that does not exceed the screen dimensions.
Comments
The maximum applet size was increased to 4000-8192(depends from the system opengl).
27-02-2014

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

Converted "8-client-defer-candidate" label to "8-defer-request" by SQE' OK.
15-08-2013

*This is anti-deferral criteria list*: - P2 -------------- Engineering's Criteria ------------------------------------- - tck-red labeled - conformance labeled - P3 regressions reported/labeled against jdk8 - findbugs, parfait, eht labeled bugs - CAP <1 year reported - netbeans <1 year reported Victor ----------------- SQE's OK --------------------------------- Yes, we are ok with that thanks, Mikhail
15-08-2013

Looks like it was fixed as part of JDK-8000629: see changes in CGraphicsDevice.java & CGLLayer.m. I'll check it and close it as duplicate.
22-05-2013