Compare commits

...

74 Commits

Author SHA1 Message Date
Alexey Ushakov
e309845093 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Screen rendering tests in progress
2019-06-25 01:55:17 +03:00
Alexey Ushakov
e838103a24 JBR-1624 Fonts rendering is broken in the 2019.2 EAP (Fira Code)
Lower priority for idea bundled fonts to pickup platform ones
(if installed)
2019-06-24 23:30:57 +03:00
Anton Tarasov
e7ca6db66b JBR-1492 Not able to start Intellij Idea 2017.2.5 with modified vmoptions 2019-06-24 14:29:50 +03:00
Vitaly Provodin
d9656a178b updated JTreg exclude list 2019-06-23 07:54:43 +07:00
Vitaly Provodin
5f6351b0c4 updated JTreg exclude list 2019-06-23 07:40:54 +07:00
Vitaly Provodin
c3a0ec902d updated JTreg exclude list 2019-06-22 06:01:31 +07:00
Anton Tarasov
567d96c428 Merge remote-tracking branch 'origin/master' 2019-06-20 21:02:12 +03:00
Anton Tarasov
1666f05b23 JBR-1617 revert fixes for app icon 2019-06-20 21:01:34 +03:00
Egor Ushakov
ae823a660b JBR-1615 Slow ClassLoaderReferenceImpl.findType 2019-06-20 17:52:15 +03:00
Denis Fokin
f6a31f444c Revert: JBR-1583 Fight MAC OS X "Please call TIS/TSM in main thread!!!" message 2019-06-20 14:15:19 +03:00
Dmitry Batrak
a1b4cd964a JBR-1604 Tooltip with package's info is cut 2019-06-19 17:15:15 +03:00
Elena Sayapina
5845719fe5 updated JTreg exclude list 2019-06-17 16:49:18 +07:00
alexsch
dae56a9e8b JBR-1066: fixed ScreenMenuMemoryLeakTest
re-apply fix that was reverted in 2a92eec5:
8158325: [macosx] Memory leak in com.apple.laf.ScreenMenu
Reviewed-by: azvegint, alexsch
Contributed-by: Robin Stevens <robin.stevens@scz.be>

NOTE: fix 8158325 caused 'JBR-922 Actions from system menu does not work on jdk9 runtime', 'IDEA-183063 MacOS: popups are closing, main menu actions will not open when running under Oracle 1.8.152 JDK'. This fix was reapplied because it is correct and bugs aren't reproduced now.

(cherry picked from commit 0a4920f61d)
2019-06-14 16:36:53 +07:00
Anton Tarasov
9cc97b0c00 [followup] JBR-1351 Borderless UI: Bold frame around IDEA window appears on non-HiDPI display 2019-06-13 20:15:41 +03:00
Denis Fokin
936dc2c40b JBR-1583 Fight MAC OS X "Please call TIS/TSM in main thread!!!" message
Crash is fixed
2019-06-11 12:59:53 +03:00
Anton Tarasov
db6c43b6f4 JBR-1414 DnD on linux (XToolkit) does not honor HIDPI scale 2019-06-10 19:11:43 +03:00
Artem Bochkarev
bd9a95d6fb JRE-220: fixed 'terminal Ctrl+C is not working'
cherry-picked from a8c7db34
2019-06-08 14:28:34 +07:00
Denis Fokin
8d9bac395e JBR-1583 Fight MAC OS X "Please call TIS/TSM in main thread!!!" message 2019-06-07 16:27:58 +03:00
Anton Tarasov
f652c790f4 Merge remote-tracking branch 'origin/master' 2019-06-07 15:21:58 +03:00
Anton Tarasov
8e59bb2f09 JBR-1582 IDEA EAP icon has low resolution on Mac 2019-06-07 15:21:28 +03:00
Artem Bochkarev
c8533a1219 JBR-1573: fix resources cleanup
JBR-1573: fix resources cleanup
2019-06-07 10:48:13 +07:00
Denis Fokin
f35489e8ca JBR-1574 java/awt/Window/setLocRelativeTo/SetLocationRelativeToTest.java: Test failed 2019-06-06 23:58:13 +03:00
Artem Bochkarev
3ad94911af JBR-1573: workaround for 'Sudden keyboard death on Ubuntu 18'
recreate instance of system InputMethod when starts filter all events
2019-06-06 17:53:25 +07:00
Denis Fokin
31629b719d Yet another forgotten file. 2019-06-05 13:02:45 +03:00
Denis Fokin
0e3ce4aa6a These files are generated by gradle. They prevent users from rebase. 2019-06-05 12:53:24 +03:00
Denis Fokin
4cef4a36c7 JBR-1569 Transparent title bars not working in JRE 11 2019-06-04 18:25:53 +03:00
Denis Fokin
7a05ec59e0 Revert: JBR-1414 DnD on linux  (XToolkit) does not honor HIDPI scale
Regression: JBR-1558 Drag'n'drop in trees doesn't work properly in master builds on HiDPI displays
2019-06-04 14:30:32 +03:00
Vitaly Provodin
26807f5975 updated JTreg exclude list 2019-06-04 10:36:07 +07:00
Vitaly Provodin
85dad30333 updated JTreg exclude list 2019-06-04 06:24:55 +07:00
Anton Tarasov
9f7289d5ef Merge remote-tracking branch 'origin/master' 2019-06-03 12:49:07 +03:00
Anton Tarasov
14d51243c6 JBR-1544 Robot cannot capture screen with scale other than 1:1 2019-06-03 12:48:45 +03:00
Alexey Ushakov
350a3fdef3 JBR-1399 Improve font discovery and loading by introducing font cache
Bundle IDEA fonts to improve startup performance
2019-05-31 20:24:27 +03:00
Denis Fokin
ae087bad40 JBR-1421 Cannot type opening square bracket or brace with a Spanish-ISO keyboard macOS 2019-05-31 12:30:22 +03:00
Vitaly Provodin
74b2cb3607 updated JTreg exclude list 2019-05-31 15:09:00 +07:00
Denis Fokin
63f98e40a6 JBR-1421 Cannot type opening square bracket or brace with a Spanish-ISO keyboard macOS
Forgotten change
2019-05-30 16:49:27 +03:00
Vyacheslav Moklev
5547701e2c JBR-1552 Invalid screen bounds in full screen mode
Check is window is not in undecorated state
2019-05-30 11:02:00 +03:00
Denis Fokin
1ca0a3f140 JBR-1522 JDK11 does not reset reused heavy-weight popup window min-size 2019-05-29 12:47:19 +03:00
Alexey Ushakov
194b2d939f Updated RenderPerfTest to use correct location of the frame marker 2019-05-28 15:14:20 +03:00
Alexey Ushakov
943b1472c7 Updated RenderUtil to get correct screenshots on linux 2019-05-28 14:50:29 +03:00
Alexey Ushakov
83c22de72e Added golden images for MixedTextTest and TextMetricsTest from Linux 2019-05-28 14:50:29 +03:00
Artem Bochkarev
62d057516d JBR-1400: don't clear application NSMenu when defined vm-property 'mac.system.menu.singleton'
cherry-pick from commit bc8eca286b42306c66890dbeef2bfd2f4aa48a5d (from jdk8u)
2019-05-28 11:38:02 +07:00
Artem Bochkarev
e57384c1d6 JBR-1541: activate menu in completion handler of modal dialog 2019-05-28 11:28:30 +07:00
Vitaly Provodin
3655b01149 updated JTreg exclude list 2019-05-28 10:13:54 +07:00
Alexey Ushakov
5f9b3a6dda JBR-1521 Update quality tests to Java 11
Added golden images for TextMetricsTest from Mojave
2019-05-27 13:38:48 +03:00
Alexey Ushakov
cab6dd5087 JBR-1521 Update quality tests to Java 11
Added golden images for MixedTextTest from Mojave
2019-05-27 13:21:51 +03:00
Vitaly Provodin
e4b063cb1f updated JTreg exclude list 2019-05-27 14:24:08 +07:00
Alexey Ushakov
bbd90315c9 JBR-1521 Update quality tests to Java 11
Updated golden images for DroidFontTest on Windows
2019-05-26 18:51:25 +03:00
Alexey Ushakov
c93b853a2b Updated gradle project:
- provided correct path to test jdk
 - used modern syntax instead of <<
2019-05-26 14:56:31 +03:00
Vitaly Provodin
d65279cdc1 updated JTreg exclude list 2019-05-24 10:49:09 +07:00
Alexey Ushakov
6c71f3a853 JBR-1521 Update quality tests to Java 11
Updated golden images for DroidFontTest on linux
2019-05-22 22:56:57 +03:00
Alexey Ushakov
95a5c1661b JBR-1521 Update quality tests to Java 11
Added golden images for DroidFontTest from Mojave
2019-05-22 16:59:01 +03:00
Alexey Ushakov
153020320d JBR-1415 CLion with jdk11, frame around Exit button
In addition fallback to normal painting for sub-components of non-opaque
dialogs and frames
2019-05-21 19:27:59 +03:00
Alexey Ushakov
23e2ac4c4e JBR-1528 backport rendering performance microbenchmarks from openjdk-metal branch
Backport test/jdk/jbu/quality/metal/MetalRenderTest.java
2019-05-21 12:51:57 +03:00
Denis Fokin
29ec6c2bce JBR-1311 [JBR 11] Double quote adding special character on macOS with "English, U.S. International - PC" layout 2019-05-20 19:58:03 +03:00
Alexey Ushakov
7997c7a5ee JBR-1521 Update quality tests to Java 11
Updated RenderUtil to Java 11
2019-05-17 23:17:47 +03:00
Alexey Ushakov
14659f0d30 JBR-1520 [fwp to JBR11] JRE-722 LCD text rendering performance on OSX 25X slower than grayscale
Fixed LCD text performance by using bulk rendering via vertex arrays and
reducing glTextureBarrierNV usages
Added native logging of accelerated text rendering
Replaced glClientActiveTextureARB with glClientActiveTexture
(it is now part of OpenGL 1.3 standard)
2019-05-17 23:17:46 +03:00
Alexey Ushakov
a868128d2e Updated .gitignore 2019-05-17 23:17:46 +03:00
Dmitry Batrak
1e1b932a4c JBR-1517 Update font layout speedup code to match the variant submitted to OpenJDK (JDK-8220231)
apply corresponding change from OpenJDK 13
2019-05-17 15:08:47 +03:00
Dmitry Batrak
bac12d4598 JBR-1517 Update font layout speedup code to match the variant submitted to OpenJDK (JDK-8220231)
revert original implementation of font layout speedup
2019-05-17 13:19:43 +03:00
Dmitry Batrak
2bbfe3bf2f JBR-1435 Various problems with emojis
add piece of code that was missed during migration from JBR 8
2019-05-17 11:23:03 +03:00
Vitaly Provodin
38abcae3e9 updated JTreg exclude list 2019-05-17 14:09:59 +07:00
Anton Tarasov
1746b04686 JBR-1427 pycharm jupyter preview stuck and no response when click on preview. 2019-05-16 18:28:02 +03:00
Vyacheslav Moklev
00d32e58dc JBR-1509 Client area size is wrong in Borderless mode
Fix client area size
2019-05-16 11:51:42 +03:00
Denis Fokin
d0acd2b182 JBR-1255 [JDK 11] java.lang.IllegalArgumentException: Wrong parent window 2019-05-15 19:26:44 +03:00
Denis Fokin
fbb8ed8326 JBR-1434 "New file dialog" popup remains above all windows on switching application 2019-05-15 19:22:00 +03:00
Denis Fokin
54bb2dd097 JBR-1417 JBR 11 does not support chain of popups
Adopted version of "JRE-864  Multiple child windows opened and closed in sequence"
2019-05-14 17:11:51 +03:00
Vitaly Provodin
fe6bc5f94d updated JTreg exclude list 2019-05-14 16:29:15 +07:00
Denis Fokin
2a8bced104 Revert: JBR-1311 [JBR 11] Double quote adding special character on macOS with "English, U.S. International - PC" layout
JBR-1421 resolves the issue
2019-05-13 20:51:59 +03:00
Denis Fokin
b0366b1c0d JBR-1421 Cannot type opening square bracket or brace with a Spanish-ISO keyboard macOS 2019-05-13 20:45:19 +03:00
Vitaly Provodin
33001a74d0 updated JTreg exclude list 2019-05-13 16:29:38 +07:00
Denis Fokin
85dfaefecb JBR-1414 DnD on linux (XToolkit) does not honor HIDPI scale 2019-05-08 09:46:26 +03:00
itakiguchi
7d1cd2b825 8211810: X11 Time stamp data should be unsigned
Reviewed-by: serb
2019-05-08 09:46:25 +03:00
Artem Bochkarev
7aa5324011 fixed JBR-1135
don't skip KeyEvents with character A (with keycode == 0) in AWTView::performKeyEquivalent

this condition was added in fix "JBR-184 Mac OS: Delete action deletes twice if Edit menu has be opened before",
it seems that this condition is unnecessary and JBR-184 doesn't reproduce without it.
2019-05-08 11:27:55 +07:00
Alexey Ushakov
434166fe63 JBR-1412 [fwp to JBR11] JBR-1393 RubyMine is hanging after log in (macOS)
Modified version of JBR8 fix
2019-05-07 14:35:11 +03:00
137 changed files with 2359 additions and 864 deletions

2
.gitignore vendored
View File

@@ -3,3 +3,5 @@ JTreport
*.class
.idea/workspace.xml
build/
# Project exclude paths
/jb/project/java-gradle/.gradle/

2
jb/project/java-gradle/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel>
<module name="java-gradle.main" target="11" />
<module name="java-gradle.test" target="11" />
</bytecodeTargetLevel>
</component>
</project>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="/usr/share/gradle" />
<option name="gradleJvm" value="11" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useAutoImport" value="true" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.common:common-image:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-image/3.3.2/9c975152864050c6dbb7226ca1100694f0aa099d/common-image-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-image/3.3.2/e6fb35a9825421ec5a634af328e22546992d536d/common-image-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.common:common-io:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-io/3.3.2/e00b1c744993864d3c8dc698ba7d356122019398/common-io-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-io/3.3.2/dbb242585fdfd353dc4c2c0e8b3d8b0383dffbb2/common-io-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.common:common-lang:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-lang/3.3.2/ffbc5e05208c5c9cb43052438294c3ec5546aecf/common-lang-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.common/common-lang/3.3.2/b695db345614a2b9344fd43a44d9ce722df4b39/common-lang-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.imageio:imageio-core:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-core/3.3.2/8def41c756831dde3c23f2d525e5667cfbfa1847/imageio-core-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-core/3.3.2/abcb2beaf21364467afe0e33824dce5730bef0c3/imageio-core-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.imageio:imageio-metadata:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-metadata/3.3.2/b8a31725bde0dc6f4e6b01711784f5ca0a2275f3/imageio-metadata-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-metadata/3.3.2/6fc3b223c81afbd4b829e2c924c096aab3ed0e9e/imageio-metadata-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.twelvemonkeys.imageio:imageio-tiff:3.3.2">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-tiff/3.3.2/9bea1214eae7d287dc0c685fb6be75102318d080/imageio-tiff-3.3.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.twelvemonkeys.imageio/imageio-tiff/3.3.2/cae5b3540dc01889dc9560db86f5f61bdc253107/imageio-tiff-3.3.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: junit:junit:4.12">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/a6c32b40bf3d76eca54e3c601e5d1470c86fcdfa/junit-4.12-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: net.java.dev.jna:jna:4.4.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/4.4.0/cb208278274bf12ebdb56c61bd7407e6f774d65a/jna-4.4.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/4.4.0/9d45d3dc35711eef7267d8b4fc2c0dc482ef9fd2/jna-4.4.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.apache.commons:commons-lang3:3.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.0/8873bd0bb5cb9ee37f1b04578eb7e26fcdd44cb0/commons-lang3-3.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.0/d48f964b56a931ec2712ce5d411a40d114a69753/commons-lang3-3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.hamcrest:hamcrest-core:1.3">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: org.hamcrest:hamcrest-library:1.3">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/4785a3c21320980282f9f33d0d1264a69040538f/hamcrest-library-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/47a7ee46628ab7133129cd7cef1e92657bc275e/hamcrest-library-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/java-gradle.iml" filepath="$PROJECT_DIR$/.idea/modules/java-gradle.iml" />
<module fileurl="file://$PROJECT_DIR$/java-gradle.iml" filepath="$PROJECT_DIR$/java-gradle.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/java-gradle.main.iml" filepath="$PROJECT_DIR$/.idea/modules/java-gradle.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/java-gradle.test.iml" filepath="$PROJECT_DIR$/.idea/modules/java-gradle.test.iml" />
</modules>
</component>
</project>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="java-gradle:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<output url="file://$MODULE_DIR$/../../out/production/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/main" />
<content url="file://$MODULE_DIR$/../../../../../src">
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.base/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.datatransfer/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.desktop/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.instrument/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.logging/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.management.rmi/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.management/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.naming/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.prefs/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.rmi/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.scripting/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.se/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.security.jgss/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.security.sasl/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.smartcardio/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.sql.rowset/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.sql/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.xml.crypto/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.base/macosx/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.datatransfer/macosx/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.desktop/macosx/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../../../src/java.prefs/macosx/classes" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="java-gradle:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">
<output-test url="file://$MODULE_DIR$/../../out/test/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/test" />
<content url="file://$MODULE_DIR$/../../../../../test">
<sourceFolder url="file://$MODULE_DIR$/../../../../../test/jdk/jbu" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="java-gradle.main" />
<orderEntry type="library" name="Gradle: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" name="Gradle: net.java.dev.jna:jna:4.4.0" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.imageio:imageio-tiff:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: org.apache.commons:commons-lang3:3.0" level="project" />
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.imageio:imageio-metadata:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.imageio:imageio-core:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.common:common-image:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.common:common-io:3.3.2" level="project" />
<orderEntry type="library" name="Gradle: com.twelvemonkeys.common:common-lang:3.3.2" level="project" />
</component>
<component name="TestModuleProperties" production-module="java-gradle.main" />
</module>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@@ -10,11 +10,11 @@ def test_jvm = {
file(jbsdkhome + (OperatingSystem.current().isWindows()?"/bin/java.exe" : "/bin/java")).absolutePath
} else {
if (OperatingSystem.current().isMacOsX()) {
file('../../../build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-11.jdk/Contents/Home/bin/java').absolutePath
file('../../../build/macosx-x86_64-normal-server-release/images/jdk-bundle/jdk-11.0.3.jdk/Contents/Home/bin/java').absolutePath
} else if (OperatingSystem.current().isLinux()) {
file('../../../build/linux-x86_64-normal-server-release/images/jdk/bin/java').absolutePath
} else {
file('../../../build/windows-x86_64-normal-server-release/images/j2sdk-image/bin/java.exe').absolutePath
file('../../../build/windows-x86_64-normal-server-release/images/jdk/bin/java.exe').absolutePath
}
}
}
@@ -75,15 +75,22 @@ test.dependsOn tasks.compileTestJava
test {
systemProperty "jb.java2d.metal", "true"
systemProperty "testdata", file('../../../jb/tests/testdata').absolutePath
systemProperty "testdata", file('../../../test/jdk/jbu/testdata').absolutePath
// Generate golden images for DroidFontTest and MixedTextTest
// systemProperty "gentestdata", ""
// Enable Java2D logging (https://confluence.jetbrains.com/display/JRE/Java2D+Rendering+Logging)
// systemProperty "sun.java2d.trace", "log"
// systemProperty "sun.java2d.debugfonts", "warn"
// systemProperty "sun.java2d.trace", "log,pimpl"
outputs.upToDateWhen { false }
executable = test_jvm()
// Enable J2D logging (only in debug build)
// Enable async/dtrace profiler
jvmArgs "-XX:+PreserveFramePointer"
// Enable native J2D logging (only in debug build)
// Can be turned on for J2D by adding "#define DEBUG 1" into jdk/src/share/native/sun/java2d/Trace.h
// environment 'J2D_TRACE_LEVEL', '4'
@@ -96,24 +103,34 @@ if (OperatingSystem.current().isWindows()) {
def cyg_make_cmd = new File("c:/cygwin64/bin/make.exe")
if (cyg_make_cmd.exists()) make_cmd = cyg_make_cmd.absolutePath
}
task make_images << {
def pb = new ProcessBuilder().command(make_cmd.toString(), "-C", buildDir.absolutePath, "images")
def proc = pb.redirectErrorStream(true).start()
proc.inputStream.eachLine {println it}
assert proc.waitFor() == 0
def test_run = false
task make_images {
doLast {
if (!test_run) {
def pb = new ProcessBuilder().command(make_cmd.toString(), "-C", buildDir.absolutePath, "images")
def proc = pb.redirectErrorStream(true).start()
proc.inputStream.eachLine { println it }
assert proc.waitFor() == 0
}
}
}
task make_clean << {
def pb = new ProcessBuilder().command(make_cmd.toString(), "-C", buildDir.absolutePath, "clean")
def proc = pb.redirectErrorStream(true).start()
proc.inputStream.eachLine {println it}
assert proc.waitFor() == 0
task make_clean {
doLast {
def pb = new ProcessBuilder().command(make_cmd.toString(), "-C", buildDir.absolutePath, "clean")
def proc = pb.redirectErrorStream(true).start()
proc.inputStream.eachLine { println it }
assert proc.waitFor() == 0
}
}
task run_test {
doLast {
test_run = true
}
}
tasks.compileJava.enabled = false
tasks.compileTestJava.dependsOn.clear()
tasks.cleanTest.dependsOn tasks.run_test
classes.dependsOn.clear()
classes.dependsOn tasks.make_images
tasks.cleanClasses.dependsOn tasks.make_clean

View File

@@ -82,11 +82,11 @@ public class AquaImageFactory {
}
static Image getGenericJavaIcon() {
return java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
return checkValidOrStub(java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
public Image run() {
return com.apple.eawt.Application.getApplication().getDockIconImage();
}
});
}));
}
static String getPathToThisApplication() {
@@ -496,4 +496,23 @@ public class AquaImageFactory {
public static Color getSelectionInactiveForegroundColorUIResource() {
return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
}
private static class EmptyImage {
static final BufferedImage INSTANCE;
static {
INSTANCE = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
Graphics g = INSTANCE.createGraphics();
g.setColor(new Color(0, 0, 0, 0));
g.fillRect(0, 0, 16, 16);
g.dispose();
}
}
// [tav] a workaround for JBR-1492
private static Image checkValidOrStub(Image image) {
if (image == null || image.getWidth(null) <= 0 || image.getHeight(null) <= 0) {
return EmptyImage.INSTANCE;
}
return image;
}
}

View File

@@ -110,6 +110,7 @@ final class ScreenMenu extends Menu
final Component[] items = fInvoker.getMenuComponents();
if (needsUpdate(items, childHashArray)) {
removeAll();
fItems.clear();
if (count <= 0) return;
childHashArray = new int[count];
@@ -246,7 +247,7 @@ final class ScreenMenu extends Menu
synchronized (getTreeLock()) {
super.addNotify();
if (fModelPtr == 0) {
fInvoker.addContainerListener(this);
fInvoker.getPopupMenu().addContainerListener(this);
fInvoker.addComponentListener(this);
fPropertyListener = new ScreenMenuPropertyListener(this);
fInvoker.addPropertyChangeListener(fPropertyListener);
@@ -281,7 +282,7 @@ final class ScreenMenu extends Menu
if (fModelPtr != 0) {
removeMenuListeners(fModelPtr);
fModelPtr = 0;
fInvoker.removeContainerListener(this);
fInvoker.getPopupMenu().removeContainerListener(this);
fInvoker.removeComponentListener(this);
fInvoker.removePropertyChangeListener(fPropertyListener);
}
@@ -302,11 +303,10 @@ final class ScreenMenu extends Menu
@Override
public void componentRemoved(final ContainerEvent e) {
final Component child = e.getChild();
final MenuItem sm = fItems.get(child);
final MenuItem sm = fItems.remove(child);
if (sm == null) return;
remove(sm);
fItems.remove(sm);
}
/**

View File

@@ -31,20 +31,12 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.security.AccessController;
import java.security.PrivilegedAction;
// Right now this class is final to avoid a problem with native code.
// For some reason the JNI IsInstanceOf was not working correctly
// so we are checking the class specifically. If we subclass this
// we need to modify the native code in CFontWrapper.m
public final class CFont extends PhysicalFont implements FontSubstitution {
private static final boolean useCoreTextLayout;
static {
useCoreTextLayout = AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
Boolean.getBoolean("sun.font.use.coretext.layout"));
}
/* CFontStrike doesn't call these methods so they are unimplemented.
* They are here to meet the requirements of PhysicalFont, needed
@@ -84,18 +76,11 @@ public final class CFont extends PhysicalFont implements FontSubstitution {
throw new InternalError("Not implemented");
}
@Override
protected long getLayoutTableCache() {
return getLayoutTableCacheNative(getNativeFontPtr());
}
@Override
protected byte[] getTableBytes(int tag) {
return getTableBytesNative(getNativeFontPtr(), tag);
}
private native synchronized long getLayoutTableCacheNative(long nativeFontPtr);
private native byte[] getTableBytesNative(long nativeFontPtr, int tag);
private static native long createNativeFont(final String nativeFontName,
@@ -254,13 +239,6 @@ public final class CFont extends PhysicalFont implements FontSubstitution {
return nativeFontName;
}
@Override
protected boolean isAAT() {
// CoreText layout code ignores fractional metrics font attribute
// also, using CoreText layout in Harfbuzz code leads to wrong advances for emoji glyphs
return useCoreTextLayout && !"AppleColorEmoji".equals(nativeFontName) && super.isAAT();
}
// <rdar://problem/5321707> sun.font.Font2D caches the last used strike,
// but does not check if the properties of the strike match the properties
// of the incoming java.awt.Font object (size, style, etc).

View File

@@ -957,24 +957,17 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
}
boolean res = parentPeer.requestWindowFocus(cause);
// If parent window can be made focused and has been made focused (synchronously)
// then we can proceed with children, otherwise we retreat
if (!res || !parentWindow.isFocused()) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("request rejected, res= " + res + ", parentWindow.isFocused()=" +
parentWindow.isFocused());
}
return parentPeer.requestWindowFocus(cause, () -> {
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
return false;
}
}, () -> {
KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
Component focusOwner = kfmPeer.getCurrentFocusOwner();
return LWKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
getTarget(), temporary,
focusedWindowChangeAllowed,
time, cause, focusOwner);
Component focusOwner = kfmPeer.getCurrentFocusOwner();
LWKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
getTarget(), temporary,
focusedWindowChangeAllowed,
time, cause, focusOwner);
});
case LWKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
return true;

View File

@@ -61,18 +61,18 @@ public class LWLightweightFramePeer extends LWWindowPeer implements OverrideNati
}
@Override
public boolean requestWindowFocus(FocusEvent.Cause cause) {
public boolean requestWindowFocus(FocusEvent.Cause cause, Runnable r, Runnable lightweightRequest) {
if (!focusAllowedFor()) {
return false;
}
if (getPlatformWindow().rejectFocusRequest(cause)) {
/*if (getPlatformWindow().rejectFocusRequest(cause)) {
return false;
}
}*/
Window opposite = LWKeyboardFocusManagerPeer.getInstance().
getCurrentFocusedWindow();
changeFocusedWindow(true, opposite);
changeFocusedWindow(true, opposite, () -> {});
return true;
}

View File

@@ -61,16 +61,8 @@ import java.util.List;
import javax.swing.JComponent;
import sun.awt.AWTAccessor;
import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.AppContext;
import sun.awt.CGraphicsDevice;
import sun.awt.DisplayChangedListener;
import sun.awt.ExtendedKeyCodes;
import sun.awt.FullScreenCapable;
import sun.awt.SunToolkit;
import sun.awt.TimedWindowEvent;
import sun.awt.UngrabEvent;
import sun.java2d.NullSurfaceData;
import sun.java2d.SunGraphics2D;
import sun.java2d.SunGraphicsEnvironment;
@@ -297,14 +289,24 @@ public class LWWindowPeer
if (!getTarget().isAutoRequestFocus()) {
return;
} else {
requestWindowFocus(FocusEvent.Cause.ACTIVATION);
requestWindowFocus(FocusEvent.Cause.ACTIVATION, () -> {}, () -> {});
}
// Focus the owner in case this window is focused.
} else if (kfmPeer.getCurrentFocusedWindow() == getTarget()) {
// Transfer focus to the owner.
LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this);
if (owner != null) {
owner.requestWindowFocus(FocusEvent.Cause.ACTIVATION);
Window targetOwner = LWWindowPeer.this.getTarget().getOwner();
while (targetOwner != null && (targetOwner.getOwner() != null && !targetOwner.isFocusableWindow())) {
targetOwner = targetOwner.getOwner();
}
if (targetOwner != null) {
LWWindowPeer owner = (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(targetOwner);
if (owner != null) {
owner.requestWindowFocus(FocusEvent.Cause.ACTIVATION, () -> {}, () -> {});
}
}
}
}
@@ -781,7 +783,7 @@ public class LWWindowPeer
@Override
public void notifyActivation(boolean activation, LWWindowPeer opposite) {
Window oppositeWindow = (opposite == null)? null : opposite.getTarget();
changeFocusedWindow(activation, oppositeWindow);
changeFocusedWindow(activation, oppositeWindow, () -> {});
}
// MouseDown in non-client area
@@ -898,7 +900,7 @@ public class LWWindowPeer
// 2. An active but not focused owner frame/dialog is clicked.
// The mouse event then will trigger a focus request "in window" to the component, so the window
// should gain focus before.
requestWindowFocus(FocusEvent.Cause.MOUSE_EVENT);
requestWindowFocus(FocusEvent.Cause.MOUSE_EVENT, () -> {}, () -> {});
mouseDownTarget[targetIdx] = targetPeer;
} else if (id == MouseEvent.MOUSE_DRAGGED) {
@@ -1249,19 +1251,20 @@ public class LWWindowPeer
* Requests platform to set native focus on a frame/dialog.
* In case of a simple window, triggers appropriate java focus change.
*/
public boolean requestWindowFocus(FocusEvent.Cause cause) {
public boolean requestWindowFocus(FocusEvent.Cause cause, Runnable rejectFocusRequest, Runnable lightweightRequest) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("requesting native focus to " + this);
}
if (!focusAllowedFor()) {
focusLog.fine("focus is not allowed");
rejectFocusRequest.run();
return false;
}
if (platformWindow.rejectFocusRequest(cause)) {
return false;
}
// if (platformWindow.rejectFocusRequest(cause)) {
// return false;
// }
AppContext targetAppContext = AWTAccessor.getComponentAccessor().getAppContext(getTarget());
KeyboardFocusManager kfm = AWTAccessor.getKeyboardFocusManagerAccessor()
@@ -1299,18 +1302,24 @@ public class LWWindowPeer
}
// DKFM will synthesize all the focus/activation events correctly.
changeFocusedWindow(true, opposite);
changeFocusedWindow(true, opposite, lightweightRequest);
return true;
// In case the toplevel is active but not focused, change focus directly,
// as requesting native focus on it will not have effect.
} else if (getTarget() == currentActive && !getTarget().hasFocus()) {
changeFocusedWindow(true, opposite);
changeFocusedWindow(true, opposite, lightweightRequest);
return true;
}
return platformWindow.requestWindowFocus();
focusLog.fine("platformWindow.requestWindowFocus()");
boolean requestFocusResult = platformWindow.requestWindowFocus();
if (requestFocusResult) {
lightweightRequest.run();
return true;
}
return false;
}
protected boolean focusAllowedFor() {
@@ -1338,7 +1347,7 @@ public class LWWindowPeer
@Override
public void emulateActivation(boolean activate) {
changeFocusedWindow(activate, null);
changeFocusedWindow(activate, null, () -> {});
}
@SuppressWarnings("deprecation")
@@ -1357,7 +1366,7 @@ public class LWWindowPeer
/*
* Changes focused window on java level.
*/
protected void changeFocusedWindow(boolean becomesFocused, Window opposite) {
protected void changeFocusedWindow(boolean becomesFocused, Window opposite, Runnable lightweightRequestRunnable) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this);
}
@@ -1395,19 +1404,22 @@ public class LWWindowPeer
}
KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
if (!becomesFocused && kfmPeer.getCurrentFocusedWindow() != getTarget()) {
// late window focus lost event - ingoring
return;
}
kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null);
int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS;
WindowEvent windowEvent = new TimedWindowEvent(getTarget(), eventID, opposite, System.currentTimeMillis());
SunToolkit.setSystemGenerated(windowEvent);
AWTAccessor.getAWTEventAccessor().setPosted(windowEvent);
PeerEvent pe = new PeerEvent(getTarget(), () -> {
((Component)windowEvent.getSource()).dispatchEvent(windowEvent);
if (becomesFocused) {
lightweightRequestRunnable.run();
}
}, PeerEvent.ULTIMATE_PRIORITY_EVENT);
// TODO: wrap in SequencedEvent
postEvent(windowEvent);
postEvent(pe);
}
/*
@@ -1515,4 +1527,4 @@ public class LWWindowPeer
public String toString() {
return super.toString() + " [target is " + getTarget() + "]";
}
}
}

View File

@@ -47,7 +47,7 @@ public class CImage extends CFRetainedResource {
private static native long nativeCreateNSImageFromImageName(String name);
private static native long nativeCreateNSImageFromIconSelector(int selector);
private static native byte[] nativeGetPlatformImageBytes(int[] buffer, int w, int h);
private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int dw, int dh);
private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int sw, int sh, int dw, int dh);
private static native Dimension2D nativeGetNSImageSize(long image);
private static native void nativeSetNSImageSize(long image, double w, double h);
private static native void nativeResizeNSImageRepresentations(long image, double w, double h);
@@ -280,8 +280,8 @@ public class CImage extends CFRetainedResource {
if (size == null) {
return null;
}
final int baseWidth = (int)size.getWidth();
final int baseHeight = (int)size.getHeight();
final int w = (int)size.getWidth();
final int h = (int)size.getHeight();
AtomicReference<Dimension2D[]> repRef = new AtomicReference<>();
execute(ptr -> {
repRef.set(nativeGetNSImageRepresentationSizes(ptr, size.getWidth(),
@@ -289,31 +289,18 @@ public class CImage extends CFRetainedResource {
});
Dimension2D[] sizes = repRef.get();
// The image may be represented in the only size which differs from the base one.
// For instance, the app's dock icon is represented in a Retina-scaled size on Retina.
// Check if a single represenation has a bigger size and in that case use it as the dest size.
Dimension2D size0 = size;
if (sizes != null && sizes.length == 1 &&
(sizes[0].getWidth() > baseWidth && sizes[0].getHeight() > baseHeight))
{
size0 = sizes[0];
}
final int dstWidth = (int)size0.getWidth();
final int dstHeight = (int)size0.getHeight();
return sizes == null || sizes.length < 2 ?
new MultiResolutionCachedImage(baseWidth, baseHeight, (width, height)
-> toImage(dstWidth, dstHeight))
: new MultiResolutionCachedImage(baseWidth, baseHeight, sizes, (width, height)
-> toImage(width, height));
new MultiResolutionCachedImage(w, h, (width, height)
-> toImage(w, h, width, height))
: new MultiResolutionCachedImage(w, h, sizes, (width, height)
-> toImage(w, h, width, height));
}
private BufferedImage toImage(int dstWidth, int dstHeight) {
private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) {
final BufferedImage bimg = new BufferedImage(dstWidth, dstHeight, BufferedImage.TYPE_INT_ARGB_PRE);
final DataBufferInt dbi = (DataBufferInt)bimg.getRaster().getDataBuffer();
final int[] buffer = SunWritableRaster.stealData(dbi, 0);
execute(ptr->nativeCopyNSImageIntoArray(ptr, buffer, dstWidth, dstHeight));
execute(ptr->nativeCopyNSImageIntoArray(ptr, buffer, srcWidth, srcHeight, dstWidth, dstHeight));
SunWritableRaster.markDirty(dbi);
return bimg;
}

View File

@@ -758,7 +758,7 @@ public class CInputMethod extends InputMethodAdapter {
}
}
}}
}, fAwtFocussedComponent);
}, fAwtFocussedComponent, true); // [tav] avoid deadlock with javafx
} catch (InvocationTargetException ite) { ite.printStackTrace(); }
synchronized(rect) { return rect; }
@@ -779,7 +779,7 @@ public class CInputMethod extends InputMethodAdapter {
offsetInfo[0] = fIMContext.getLocationOffset(screenX, screenY);
insertPositionOffset[0] = fIMContext.getInsertPositionOffset();
}}
}, fAwtFocussedComponent);
}, fAwtFocussedComponent, true); // [tav] avoid deadlock with javafx
} catch (InvocationTargetException ite) { ite.printStackTrace(); }
// This bit of gymnastics ensures that the returned location is within the composed text.

View File

@@ -325,9 +325,9 @@ final class CPlatformResponder {
if (isISOControl) {
characterToSendWithTheEvent = checkedChar;
}
characterToSendWithTheEvent = mapNsCharsToCompatibleWithJava(characterToSendWithTheEvent);
} else {
characterToSendWithTheEvent = mapNsCharsToCompatibleWithJava(characterToSendWithTheEvent);
}
String stringWithChar = NSEvent.nsToJavaChar(characterToSendWithTheEvent, nsEvent.getModifierFlags(), spaceKeyTyped);
characterToSendWithTheEvent = stringWithChar == null ? KeyEvent.CHAR_UNDEFINED : stringWithChar.charAt(0);

View File

@@ -103,6 +103,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// for client properties
public static final String WINDOW_BRUSH_METAL_LOOK = "apple.awt.brushMetalLook";
public static final String WINDOW_DARK_APPEARANCE = "jetbrains.awt.windowDarkAppearance";
public static final String WINDOW_LIGHT_APPEARANCE = "jetbrains.awt.windowLightAppearance";
public static final String WINDOW_TRANSPARENT_TITLEBAR_APPEARANCE = "jetbrains.awt.transparentTitleBarAppearance";
public static final String WINDOW_AQUA_APPEARANCE = "jetbrains.awt.windowAquaAppearance";
public static final String WINDOW_DRAGGABLE_BACKGROUND = "apple.awt.draggableWindowBackground";
public static final String WINDOW_ALPHA = "Window.alpha";
@@ -148,6 +151,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static final int RESIZABLE = 1 << 9; // both a style bit and prop bit
static final int DARK = 1 << 28;
static final int LIGHT = 1 << 29;
static final int TRANSPARENT_TITLEBAR = 1 << 30;
static final int NONACTIVATING = 1 << 24;
static final int IS_DIALOG = 1 << 25;
static final int IS_MODAL = 1 << 26;
@@ -194,6 +199,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
new Property<CPlatformWindow>(WINDOW_DARK_APPEARANCE) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(DARK, value == null ? true : Boolean.parseBoolean(value.toString()));
}},
new Property<CPlatformWindow>(WINDOW_TRANSPARENT_TITLEBAR_APPEARANCE) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(TRANSPARENT_TITLEBAR, value == null ? true : Boolean.parseBoolean(value.toString()));
}},
new Property<CPlatformWindow>(WINDOW_LIGHT_APPEARANCE) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(LIGHT, value == null ? true : Boolean.parseBoolean(value.toString()));
}},
new Property<CPlatformWindow>(WINDOW_ALPHA) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.target.setOpacity(value == null ? 1.0f : Float.parseFloat(value.toString()));
}},
@@ -474,6 +485,16 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
styleBits = SET(styleBits, DARK, Boolean.parseBoolean(prop.toString()));
}
prop = rootpane.getClientProperty(WINDOW_TRANSPARENT_TITLEBAR_APPEARANCE);
if (prop != null) {
styleBits = SET(styleBits, TRANSPARENT_TITLEBAR, Boolean.parseBoolean(prop.toString()));
}
prop = rootpane.getClientProperty(WINDOW_LIGHT_APPEARANCE);
if (prop != null) {
styleBits = SET(styleBits, LIGHT, Boolean.parseBoolean(prop.toString()));
}
prop = rootpane.getClientProperty(WINDOW_ZOOMABLE);
if (prop != null) {
styleBits = SET(styleBits, ZOOMABLE, Boolean.parseBoolean(prop.toString()));

View File

@@ -326,10 +326,7 @@ static BOOL shouldUsePressAndHold() {
}
}
NSString *eventCharacters = [event characters];
BOOL isDeadKey = (eventCharacters != nil && [eventCharacters length] == 0);
if ((![self hasMarkedText] && fKeyEventsNeeded) || isDeadKey) {
if ((![self hasMarkedText] && fKeyEventsNeeded)) {
[self deliverJavaKeyEventHelper: event];
}
@@ -351,8 +348,6 @@ static BOOL shouldUsePressAndHold() {
AWTToolkit.latestPerformKeyEquivalentEvent = event;
[event retain];
if ([event keyCode] == 0) return NO;
if ([event keyCode] == 24 && [[event characters] isEqual:@"+"]) {
return 0;
}
@@ -516,7 +511,7 @@ static BOOL shouldUsePressAndHold() {
const UCKeyboardLayout *keyboardLayout = (UCKeyboardLayout*)CFDataGetBytePtr(keyLayoutPtr);
UInt32 isDeadKeyPressed;
UInt32 lengthOfBuffer = 4;
UInt32 lengthOfBuffer = 8;
UniChar stringWithChars[lengthOfBuffer];
UniCharCount actualLength;
@@ -527,7 +522,6 @@ static BOOL shouldUsePressAndHold() {
0,
LMGetKbdType(),
0,
// ignore for now
&isDeadKeyPressed,
lengthOfBuffer,
&actualLength,
@@ -549,8 +543,6 @@ static BOOL shouldUsePressAndHold() {
if (status == noErr && isDeadKeyPressed != 0) {
UInt32 isDeadKeyPressedForSpace;
status = UCKeyTranslate(
keyboardLayout,
kVK_Space,
@@ -558,7 +550,7 @@ static BOOL shouldUsePressAndHold() {
0,
LMGetKbdType(),
0,
&isDeadKeyPressedForSpace,
&isDeadKeyPressed,
lengthOfBuffer,
&actualLength,
stringWithChars);

View File

@@ -274,7 +274,14 @@ AWT_NS_WINDOW_IMPLEMENTATION
AWT_ASSERT_APPKIT_THREAD;
NSUInteger styleMask = [AWTWindow styleMaskForStyleBits:bits];
NSRect contentRect = rect; //[NSWindow contentRectForFrameRect:rect styleMask:styleMask];
BOOL isTransparentTitleBar = IS(bits, TRANSPARENT_TITLEBAR);
if (isTransparentTitleBar) {
styleMask = styleMask | NSFullSizeContentViewWindowMask;
}
NSRect contentRect = isTransparentTitleBar ? [NSWindow contentRectForFrameRect:rect styleMask:styleMask] : rect;
if (contentRect.size.width <= 0.0) {
contentRect.size.width = 1.0;
}
@@ -319,6 +326,11 @@ AWT_ASSERT_APPKIT_THREAD;
[self.nsWindow setCollectionBehavior:(1 << 8) /*NSWindowCollectionBehaviorFullScreenAuxiliary*/];
}
self.nsWindow.titlebarAppearsTransparent = IS(bits, TRANSPARENT_TITLEBAR);
if (self.nsWindow.titlebarAppearsTransparent) {
[self.nsWindow setTitleVisibility:NSWindowTitleHidden];
}
if (IS(self.styleBits, DARK)) {
[self.nsWindow setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
} else {

View File

@@ -201,11 +201,11 @@ AWT_ASSERT_APPKIT_THREAD;
self.fPreferencesMenu = (NSMenuItem*)[appMenu itemWithTag:PREFERENCES_TAG];
self.fAboutMenu = (NSMenuItem*)[appMenu itemAtIndex:0];
NSDockTile *dockTile = [NSApp dockTile];
self.fProgressIndicator = [[NSProgressIndicator alloc]
initWithFrame:NSMakeRect(3.f, 0.f, dockTile.size.width - 6.f, 20.f)];
[fProgressIndicator setStyle:NSProgressIndicatorBarStyle];
[fProgressIndicator setIndeterminate:NO];
[[dockTile contentView] addSubview:fProgressIndicator];
@@ -476,8 +476,20 @@ AWT_ASSERT_APPKIT_THREAD;
return;
}
// Set the app's icon instead to meet Retina.
[NSApp setApplicationIconImage:image];
// setup an image view for the dock tile
NSRect frame = NSMakeRect(0, 0, dockTile.size.width, dockTile.size.height);
NSImageView *dockImageView = [[NSImageView alloc] initWithFrame: frame];
[dockImageView setImageScaling:NSImageScaleProportionallyUpOrDown];
[dockImageView setImage:image];
[[ApplicationDelegate sharedDelegate].fProgressIndicator removeFromSuperview];
[dockImageView addSubview:[ApplicationDelegate sharedDelegate].fProgressIndicator];
// add it to the NSDockTile
[dockTile setContentView: dockImageView];
[dockTile display];
[dockImageView release];
}
+ (void)_setDockIconProgress:(NSNumber *)value {
@@ -498,8 +510,25 @@ AWT_ASSERT_APPKIT_THREAD;
+ (NSImage *)_dockIconImage {
AWT_ASSERT_APPKIT_THREAD;
// The app's dock icon defaults to the app's icon (see the spec) which is Retina-aware unlike the dock icon.
return [NSApp applicationIconImage];
NSDockTile *dockTile = [NSApp dockTile];
NSView *view = [dockTile contentView];
if ([view isKindOfClass:[NSImageView class]]) {
NSImage *img = [((NSImageView *)view) image];
if (img) return img;
}
if (view == nil) {
return [NSImage imageNamed:@"NSApplicationIcon"];
}
NSRect frame = [view frame];
NSImage *image = [[NSImage alloc] initWithSize:frame.size];
[image lockFocus];
[view drawRect:frame];
[image unlockFocus];
[image autorelease];
return image;
}
@end

View File

@@ -142,6 +142,7 @@ canChooseDirectories:(BOOL)inChooseDirectories
[thePanel setNameFieldStringValue:fFile];
}
CMenuBar *menuBar = nil;
if (fOwner != nil) {
// Finds appropriate menubar in our hierarchy,
@@ -150,7 +151,6 @@ canChooseDirectories:(BOOL)inChooseDirectories
awtWindow = awtWindow.ownerWindow;
}
CMenuBar *menuBar = nil;
BOOL isDisabled = NO;
if ([awtWindow.nsWindow isVisible]){
menuBar = awtWindow.javaMenuBar;
@@ -180,6 +180,9 @@ canChooseDirectories:(BOOL)inChooseDirectories
}
[fURLs retain];
[NSApp stopModal];
if (menuBar != nil) {
[CMenuBar activate:menuBar modallyDisabled:NO];
}
}
];

View File

@@ -257,24 +257,24 @@ JNF_COCOA_EXIT(env);
/*
* Class: sun_lwawt_macosx_CImage
* Method: nativeCopyNSImageIntoArray
* Signature: (J[III)V
* Signature: (J[IIIII)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CImage_nativeCopyNSImageIntoArray
(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint dw, jint dh)
(JNIEnv *env, jclass klass, jlong nsImgPtr, jintArray buffer, jint sw, jint sh,
jint dw, jint dh)
{
JNF_COCOA_ENTER(env);
JNF_COCOA_ENTER(env);
NSImage *img = (NSImage *)jlong_to_ptr(nsImgPtr);
jint *dst = (*env)->GetPrimitiveArrayCritical(env, buffer, NULL);
if (dst) {
NSSize size = [(NSImage *)jlong_to_ptr(nsImgPtr) size];
NSRect fromRect = NSMakeRect(0, 0, size.width, size.height);
NSRect fromRect = NSMakeRect(0, 0, sw, sh);
NSRect toRect = NSMakeRect(0, 0, dw, dh);
CImage_CopyNSImageIntoArray(img, dst, fromRect, toRect);
(*env)->ReleasePrimitiveArrayCritical(env, buffer, dst, JNI_ABORT);
}
JNF_COCOA_EXIT(env);
JNF_COCOA_EXIT(env);
}
/*

View File

@@ -30,6 +30,7 @@
#import "CMenuBar.h"
#import "CMenu.h"
#import "PropertiesUtilities.h"
#import "ThreadUtilities.h"
#import "ApplicationDelegate.h"
@@ -42,6 +43,7 @@ NSString *CMenuBarDidReuseItemNotification =
static CMenuBar *sActiveMenuBar = nil;
static NSMenu *sDefaultHelpMenu = nil;
static BOOL sSetupHelpMenu = NO;
static BOOL sUseSingleMenuBar = NO; // Equals YES when VM-property 'mac.system.menu.singleton' == true
@interface CMenuBar (CMenuBar_Private)
+ (void) addDefaultHelpMenu;
@@ -98,7 +100,8 @@ static BOOL sSetupHelpMenu = NO;
AWT_ASSERT_APPKIT_THREAD;
if (!menubar) {
[CMenuBar clearMenuBarExcludingAppleMenu_OnAppKitThread:YES];
if (!sUseSingleMenuBar)
[CMenuBar clearMenuBarExcludingAppleMenu_OnAppKitThread:YES];
return;
}
@@ -107,6 +110,8 @@ static BOOL sSetupHelpMenu = NO;
#endif
@synchronized([CMenuBar class]) {
if (sUseSingleMenuBar && sActiveMenuBar == menubar && menubar->fModallyDisabled == modallyDisabled)
return;
sActiveMenuBar = menubar;
}
@@ -397,6 +402,8 @@ static BOOL sSetupHelpMenu = NO;
@end
static BOOL sUseSingleMenuBarCalculated = NO;
/*
* Class: sun_lwawt_macosx_CMenuBar
* Method: nativeCreateMenuBar
@@ -421,6 +428,13 @@ Java_sun_lwawt_macosx_CMenuBar_nativeCreateMenuBar
}
JNF_COCOA_EXIT(env);
if (!sUseSingleMenuBarCalculated) {
NSString * sval = [PropertiesUtilities javaSystemPropertyForKey:@"mac.system.menu.singleton" withEnv:env];
sUseSingleMenuBar = sval != nil && ([@"true" caseInsensitiveCompare:sval] == 0);
sUseSingleMenuBarCalculated = YES;
}
return ptr_to_jlong(aCMenuBar);
}

View File

@@ -26,8 +26,6 @@
#import <Cocoa/Cocoa.h>
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#import "fontscalerdefs.h"
#define MAX_STACK_ALLOC_GLYPH_BUFFER_SIZE 256
@interface AWTFont : NSObject {
@@ -35,7 +33,6 @@
NSFont *fFont;
CGFontRef fNativeCGFont;
BOOL fIsFakeItalic;
TTLayoutTableCache* layoutTableCache;
}
+ (AWTFont *) awtFontForName:(NSString *)name

View File

@@ -43,33 +43,10 @@
if (self) {
fFont = [font retain];
fNativeCGFont = CTFontCopyGraphicsFont((CTFontRef)font, NULL);
layoutTableCache = NULL;
}
return self;
}
static TTLayoutTableCache* newCFontLayoutTableCache() {
TTLayoutTableCache* ltc = calloc(1, sizeof(TTLayoutTableCache));
if (ltc) {
int i;
for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
ltc->entries[i].len = -1;
}
}
return ltc;
}
static void freeCFontLayoutTableCache(TTLayoutTableCache* ltc) {
if (ltc) {
int i;
for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
if(ltc->entries[i].ptr) free (ltc->entries[i].ptr);
}
if (ltc->kernPairs) free(ltc->kernPairs);
free(ltc);
}
}
- (void) dealloc {
[fFont release];
fFont = nil;
@@ -77,10 +54,6 @@ static void freeCFontLayoutTableCache(TTLayoutTableCache* ltc) {
if (fNativeCGFont) {
CGFontRelease(fNativeCGFont);
fNativeCGFont = NULL;
if (layoutTableCache != NULL) {
freeCFontLayoutTableCache(layoutTableCache);
layoutTableCache = NULL;
}
}
[super dealloc];
@@ -91,10 +64,6 @@ static void freeCFontLayoutTableCache(TTLayoutTableCache* ltc) {
CGFontRelease(fNativeCGFont);
fNativeCGFont = NULL;
}
if (layoutTableCache != NULL) {
freeCFontLayoutTableCache(layoutTableCache);
layoutTableCache = NULL;
}
[super finalize];
}
@@ -476,23 +445,6 @@ Java_sun_font_CFont_getCGFontPtrNative
return (jlong)(awtFont->fNativeCGFont);
}
/*
* Class: sun_font_CFont
* Method: getLayoutTableCacheNative
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
Java_sun_font_CFont_getLayoutTableCacheNative
(JNIEnv *env, jclass clazz,
jlong awtFontPtr)
{
AWTFont *awtFont = (AWTFont *)jlong_to_ptr(awtFontPtr);
if (awtFont->layoutTableCache == NULL) {
awtFont->layoutTableCache = newCFontLayoutTableCache();
}
return (jlong)(awtFont->layoutTableCache);
}
/*
* Class: sun_font_CFont
* Method: getTableBytesNative

View File

@@ -663,13 +663,6 @@ public class Dialog extends Window {
public Dialog(Window owner, String title, ModalityType modalityType) {
super(owner);
if ((owner != null) &&
!(owner instanceof Frame) &&
!(owner instanceof Dialog))
{
throw new IllegalArgumentException("Wrong parent window");
}
this.title = title;
setModalityType(modalityType);
SunToolkit.checkAndSetPolicy(this);

View File

@@ -496,18 +496,21 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
}
}
if (isPaint && c == rootJ && x == 0 && y == 0 &&
c.getWidth() == w && c.getHeight() == h) {
if (isPaint) {
// Fallback to normal painting in undecorated non-opaque dialogs
// and frames to resolve black background problem
if ((root instanceof Dialog && ((Dialog)root).isUndecorated() ||
root instanceof Frame && ((Frame)root).isUndecorated()) &&
bsg != null && !c.isOpaque() &&
Window window = SunToolkit.getContainingWindow(c);
if ((window instanceof Dialog && ((Dialog)window).isUndecorated() ||
window instanceof Frame && ((Frame)window).isUndecorated()) &&
bsg != null && !window.isOpaque() &&
((SunGraphics2D)bsg).getSurfaceData().getTransparency() ==
Transparency.OPAQUE) {
return false;
}
}
if (isPaint && c == rootJ && x == 0 && y == 0 &&
c.getWidth() == w && c.getHeight() == h) {
bufferInfo.setInSync(true);
}
else if (contentsLost) {

View File

@@ -347,7 +347,7 @@ public class PopupFactory {
private static final Object heavyWeightPopupCacheKey =
new StringBuffer("PopupFactory.heavyWeightPopupCache");
private volatile boolean isCacheEnabled = true;
private volatile boolean isCacheEnabled = false;
/**
* Returns either a new or recycled <code>Popup</code> containing

View File

@@ -1214,8 +1214,15 @@ public class RepaintManager
GraphicsConfiguration gc = gd.getDefaultConfiguration();
virtualBounds = virtualBounds.union(gc.getBounds());
}
doubleBufferMaxSize = new Dimension(virtualBounds.width,
virtualBounds.height);
doubleBufferMaxSize =
// Sometimes underlying desktop environment reports
// incorrect gc bounds (w=0,h=0). Replace them with
// maximum values (as we do for headless mode)
new Dimension(
virtualBounds.width == 0 ?
Integer.MAX_VALUE : virtualBounds.width,
virtualBounds.height == 0 ?
Integer.MAX_VALUE : virtualBounds.height);
} catch (HeadlessException e) {
doubleBufferMaxSize = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}

View File

@@ -1967,6 +1967,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* @see DocumentListener#insertUpdate
*/
public final void insertUpdate(DocumentEvent e) {
rootViewInitialized = false;
Document doc = e.getDocument();
Object o = doc.getProperty("i18n");
if (o instanceof Boolean) {
@@ -1995,6 +1996,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* @see DocumentListener#removeUpdate
*/
public final void removeUpdate(DocumentEvent e) {
rootViewInitialized = false;
Rectangle alloc = (painted) ? getVisibleEditorRect() : null;
rootView.removeUpdate(e, alloc, rootView.getViewFactory());
}
@@ -2010,6 +2012,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* @see DocumentListener#changedUpdate(DocumentEvent)
*/
public final void changedUpdate(DocumentEvent e) {
rootViewInitialized = false;
Rectangle alloc = (painted) ? getVisibleEditorRect() : null;
rootView.changedUpdate(e, alloc, rootView.getViewFactory());
}

View File

@@ -25,9 +25,6 @@
package sun.font;
import sun.java2d.Disposer;
import sun.java2d.DisposerRecord;
import java.awt.Font;
import java.awt.font.FontRenderContext;
import java.awt.geom.AffineTransform;
@@ -56,6 +53,7 @@ public abstract class Font2D {
public static final int NATIVE_RANK = 5;
public static final int UNKNOWN_RANK = 6;
public static final int DEFAULT_RANK = 4;
public static final int IDEA_RANK = 7;
private static final String[] boldNames = {
"bold", "demibold", "demi-bold", "demi bold", "negreta", "demi", };
@@ -80,8 +78,6 @@ public abstract class Font2D {
protected FontFamily family;
protected int fontRank = DEFAULT_RANK;
private HarfbuzzFaceRef harfbuzzFaceRef;
/*
* A mapper can be independent of the strike.
* Perhaps the reference to the mapper ought to be held on the
@@ -472,36 +468,12 @@ public abstract class Font2D {
return null;
}
/* implemented for fonts backed by an sfnt that has
* OpenType or AAT layout tables.
*/
protected long getLayoutTableCache() {
return 0L;
}
/* Used only on OS X.
*/
protected long getPlatformNativeFontPtr() {
return 0L;
}
protected boolean isAAT() {
return false;
}
synchronized long getHarfbuzzFacePtr() {
if (harfbuzzFaceRef == null) {
long harfbuzzFaceNativePtr = createHarfbuzzFace(isAAT(), getPlatformNativeFontPtr());
if (harfbuzzFaceNativePtr == 0) return 0;
harfbuzzFaceRef = new HarfbuzzFaceRef(harfbuzzFaceNativePtr);
Disposer.addObjectRecord(this, harfbuzzFaceRef);
}
return harfbuzzFaceRef.harfbuzzFaceNativePtr;
}
private native long createHarfbuzzFace(boolean aat, long platformNativeFontPtr);
private static native void disposeHarfbuzzFace(long harfbuzzFaceNativePtr);
/* for layout code */
protected long getUnitsPerEm() {
return 2048;
@@ -587,17 +559,4 @@ public abstract class Font2D {
}
}
private static class HarfbuzzFaceRef implements DisposerRecord {
private final long harfbuzzFaceNativePtr;
private HarfbuzzFaceRef(long harfbuzzFaceNativePtr) {
this.harfbuzzFaceNativePtr = harfbuzzFaceNativePtr;
}
@Override
public void dispose() {
disposeHarfbuzzFace(harfbuzzFaceNativePtr);
}
}
}

View File

@@ -219,7 +219,7 @@ public class FontFamily {
case Font.PLAIN:
case Font.ITALIC:
return (newWeight <= Font2D.FWEIGHT_NORMAL &&
newWeight > currFont.getWeight());
newWeight >= currFont.getWeight());
case Font.BOLD:
case Font.BOLD|Font.ITALIC:

View File

@@ -181,25 +181,6 @@ public abstract class FontScaler implements DisposerRecord {
abstract int getMissingGlyphCode() throws FontScalerException;
abstract int getGlyphCode(char charCode) throws FontScalerException;
/* This method returns table cache used by native layout engine.
* This cache is essentially just small collection of
* pointers to various truetype tables. See definition of TTLayoutTableCache
* in the fontscalerdefs.h for more details.
*
* Note that tables themselves have same format as defined in the truetype
* specification, i.e. font scaler do not need to perform any preprocessing.
*
* Probably it is better to have API to request pointers to each table
* separately instead of requesting pointer to some native structure.
* (then there is not need to share its definition by different
* implementations of scaler).
* However, this means multiple JNI calls and potential impact on performance.
*
* Note: return value 0 is legal.
* This means tables are not available (e.g. type1 font).
*/
abstract long getLayoutTableCache() throws FontScalerException;
/* Used by the OpenType engine for mark positioning. */
abstract Point2D.Float getGlyphPoint(long pScalerContext,
int glyphCode, int ptNumber)

View File

@@ -178,10 +178,6 @@ class FreetypeFontScaler extends FontScaler {
.getNullScaler().getGlyphVectorOutline(0L, glyphs, numGlyphs, x, y);
}
synchronized long getLayoutTableCache() throws FontScalerException {
return getLayoutTableCacheNative(nativeScaler);
}
public synchronized void dispose() {
if (nativeScaler != 0L) {
disposeNativeScaler(font.get(), nativeScaler);
@@ -258,8 +254,6 @@ class FreetypeFontScaler extends FontScaler {
native Point2D.Float getGlyphPointNative(Font2D font,
long pScalerContext, long pScaler, int glyphCode, int ptNumber);
private native long getLayoutTableCacheNative(long pScaler);
private native void disposeNativeScaler(Font2D font2D, long pScaler);
private native int getGlyphCodeNative(Font2D font, long pScaler, char charCode);

View File

@@ -64,8 +64,6 @@ class NullFontScaler extends FontScaler {
return new GeneralPath();
}
long getLayoutTableCache() {return 0L;}
long createScalerContext(double[] matrix, int aa,
int fm, float boldness, float italic, boolean disableHinting) {
return getNullScalerContext();

View File

@@ -79,12 +79,6 @@ public abstract class PhysicalFont extends Font2D {
return new Point2D.Float();
}
@Override
protected boolean isAAT() {
return getTableBytes(TrueTypeFont.morxTag) != null ||
getTableBytes(TrueTypeFont.mortTag) != null;
}
/* These 3 metrics methods should be implemented to return
* values in user space.
*/

View File

@@ -82,6 +82,24 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
}
}
private static class TTFilterIdea extends TTFilter {
final private boolean positive;
final private HashSet<String> ideaSet;
public TTFilterIdea(boolean positive, HashSet<String> ideaSet) {
this.positive = positive;
this.ideaSet = ideaSet;
}
@Override
public boolean accept(File dir, String name) {
if (super.accept(dir, name) && ideaSet.contains(name)) {
return positive;
}
return !positive;
}
}
private static class T1Filter implements FilenameFilter {
public boolean accept(File dir,String name) {
if (noType1Font) {
@@ -189,6 +207,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
boolean loadedAllFontFiles = false;
HashMap<String,String> jreFontMap;
HashSet<String> jreBundledFontFiles;
HashSet<String> ideaFontSet;
String[] jreOtherFontFiles;
boolean noOtherJREFontFiles = false; // initial assumption.
@@ -224,6 +243,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
private static final FilenameFilter ttFilter = new TTFilter();
private static final FilenameFilter t1Filter = new T1Filter();
private FilenameFilter ttFilterIdea;
private FilenameFilter ttFilterJre;
private Font[] allFonts;
private String[] allFamilies; // cache for default locale only
private Locale lastDefaultLocale;
@@ -300,6 +321,41 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
jreFontMap.put("droid serif3", "DroidSerif-BoldItalic.ttf");
jreFontMap.put("droid serif bold1", "DroidSerif-Bold.ttf");
jreFontMap.put("droid serif bold italic3", "DroidSerif-BoldItalic.ttf");
/* Idea bundled fonts */
jreFontMap.put("FiraCode bold", "FiraCode-Bold.ttf");
jreFontMap.put("FiraCode light", "FiraCode-Light.ttf");
jreFontMap.put("FiraCode medium", "FiraCode-Medium.ttf");
jreFontMap.put("FiraCode retina", "FiraCode-Retina.ttf");
jreFontMap.put("FiraCode regular", "FiraCode-Regular.ttf");
jreFontMap.put("SourceCodePro bold italic", "SourceCodePro-BoldIt.ttf");
jreFontMap.put("SourceCodePro regular", "SourceCodePro-Regular.ttf");
jreFontMap.put("SourceCodePro bold", "SourceCodePro-Bold.ttf");
jreFontMap.put("SourceCodePro italic", "SourceCodePro-It.ttf");
jreFontMap.put("Inconsolata", "Inconsolata.ttf");
jreFontMap.put("Roboto light", "Roboto-Light.ttf");
jreFontMap.put("Roboto thin", "Roboto-Thin.ttf");
ideaFontSet = new HashSet<>();
ideaFontSet.add("FiraCode-Bold.ttf");
ideaFontSet.add("FiraCode-Light.ttf");
ideaFontSet.add("FiraCode-Medium.ttf");
ideaFontSet.add("FiraCode-Retina.ttf");
ideaFontSet.add("FiraCode-Regular.ttf");
ideaFontSet.add("SourceCodePro-BoldIt.ttf");
ideaFontSet.add("SourceCodePro-Regular.ttf");
ideaFontSet.add("SourceCodePro-Bold.ttf");
ideaFontSet.add("SourceCodePro-It.ttf");
ideaFontSet.add("Inconsolata.ttf");
ideaFontSet.add("Roboto-Light.ttf");
ideaFontSet.add("Roboto-Thin.ttf");
ttFilterIdea = new TTFilterIdea(true, ideaFontSet);
ttFilterJre = new TTFilterIdea(false, ideaFontSet);
for (String ffile : jreFontMap.values()) {
jreBundledFontFiles.add(ffile);
}
@@ -403,8 +459,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
/* Linux font configuration uses these fonts */
registerFontDir(jreFontDirName);
}
registerFontsInDir(jreFontDirName, true, Font2D.JRE_RANK,
true, false);
registerJREFonts();
/* Create the font configuration and get any font path
* that might be specified.
@@ -3284,7 +3339,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
/* Called to register fall back fonts */
public void registerFontsInDir(String dirName) {
registerFontsInDir(dirName, true, Font2D.JRE_RANK, true, false);
registerJREFonts();
}
// MACOSX begin -- need to access this in subclass
@@ -3305,6 +3360,18 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
defer, resolveSymLinks);
}
protected void registerJREFonts() {
File pathFile = new File(jreFontDirName);
addDirFonts(jreFontDirName, pathFile, ttFilterIdea,
FONTFORMAT_TRUETYPE, true,
Font2D.IDEA_RANK,
true, false);
addDirFonts(jreFontDirName, pathFile, ttFilterJre,
FONTFORMAT_TRUETYPE, true,
Font2D.JRE_RANK,
true, false);
}
protected void registerFontDir(String path) {
}

View File

@@ -31,10 +31,13 @@
package sun.font;
import sun.font.GlyphLayout.*;
import sun.java2d.Disposer;
import sun.java2d.DisposerRecord;
import java.awt.geom.Point2D;
import java.lang.ref.SoftReference;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Locale;
import java.util.WeakHashMap;
/*
* different ways to do this
@@ -143,28 +146,80 @@ public final class SunLayoutEngine implements LayoutEngine, LayoutEngineFactory
}
private SoftReference<ConcurrentHashMap<LayoutEngineKey, LayoutEngine>> cacheref =
new SoftReference<>(null);
private static final WeakHashMap<Font2D, FaceRef> facePtr =
new WeakHashMap<>();
private static boolean isAAT(Font2D font) {
// CoreText layout code ignores fractional metrics font attribute
// also, using CoreText layout in Harfbuzz code leads to wrong advances for emoji glyphs
return false;
}
private SunLayoutEngine(LayoutEngineKey key) {
this.key = key;
}
private long getFacePtr(Font2D font2D) {
FaceRef ref;
synchronized (facePtr) {
ref = facePtr.computeIfAbsent(font2D, FaceRef::new);
}
return ref.getNativePtr();
}
public void layout(FontStrikeDesc desc, float[] mat, float ptSize, int gmask,
int baseIndex, TextRecord tr, int typo_flags,
Point2D.Float pt, GVData data) {
Font2D font = key.font();
FontStrike strike = font.getStrike(desc);
shape(font, strike, ptSize, mat,
font.getHarfbuzzFacePtr(), font.getPlatformNativeFontPtr(), font.isAAT(),
tr.text, data, key.script(),
tr.start, tr.limit, baseIndex, pt,
typo_flags, gmask);
long pNativeFont = font.getPlatformNativeFontPtr(); // used on OSX
long pFace = getFacePtr(font);
if (pFace != 0) {
shape(font, strike, ptSize, mat, pNativeFont,
pFace, isAAT(font),
tr.text, data, key.script(),
tr.start, tr.limit, baseIndex, pt,
typo_flags, gmask);
}
}
/* Native method to invoke harfbuzz layout engine */
private static native boolean
shape(Font2D font, FontStrike strike, float ptSize, float[] mat,
long pscaler, long pNativeFont, boolean aat,
long pNativeFont, long pFace, boolean aat,
char[] chars, GVData data,
int script, int offset, int limit,
int baseIndex, Point2D.Float pt, int typo_flags, int slot);
private static native long createFace(Font2D font,
boolean aat,
long platformNativeFontPtr);
private static native void disposeFace(long facePtr);
private static class FaceRef implements DisposerRecord {
private Font2D font;
private Long facePtr;
private FaceRef(Font2D font) {
this.font = font;
}
private synchronized long getNativePtr() {
if (facePtr == null) {
facePtr = createFace(font, isAAT(font),
font.getPlatformNativeFontPtr());
if (facePtr != 0) {
Disposer.addObjectRecord(font, this);
}
font = null;
}
return facePtr;
}
@Override
public void dispose() {
disposeFace(facePtr);
}
}
}

View File

@@ -898,15 +898,6 @@ public class TrueTypeFont extends FileFont {
}
}
@Override
protected long getLayoutTableCache() {
try {
return getScaler().getLayoutTableCache();
} catch(FontScalerException fe) {
return 0L;
}
}
@Override
protected byte[] getTableBytes(int tag) {
ByteBuffer buffer = getTableBuffer(tag);
@@ -999,12 +990,6 @@ public class TrueTypeFont extends FileFont {
return (fontWeight > 0) ? fontWeight : super.getWeight();
}
@Override
protected boolean isAAT() {
return getDirectoryEntry(TrueTypeFont.morxTag) != null ||
getDirectoryEntry(TrueTypeFont.mortTag) != null;
}
/* TrueTypeFont can use the fsSelection fields of OS/2 table
* to determine the style. In the unlikely case that doesn't exist,
* can use macStyle in the 'head' table but simpler to

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,102 @@
Copyright (c) 2014, Nikita Prokopov http://tonsky.me
with Reserved Font Name Fira Code.
Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Sans.
Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Mono.
Copyright (c) 2014, Telefonica S.A.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

View File

@@ -0,0 +1,93 @@
Copyright (c) 2011, Raph Levien (firstname.lastname@gmail.com), Copyright (c) 2012, Cyreal (cyreal.org)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,93 @@
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -88,32 +88,8 @@ typedef struct GlyphInfo {
*/
#define INVISIBLE_GLYPHS 0xfffe
#define GSUB_TAG 0x47535542 /* 'GSUB' */
#define GPOS_TAG 0x47504F53 /* 'GPOS' */
#define GDEF_TAG 0x47444546 /* 'GDEF' */
#define HEAD_TAG 0x68656164 /* 'head' */
#define MORT_TAG 0x6D6F7274 /* 'mort' */
#define MORX_TAG 0x6D6F7278 /* 'morx' */
#define KERN_TAG 0x6B65726E /* 'kern' */
typedef struct TTLayoutTableCacheEntry {
const void* ptr;
int len;
int tag;
} TTLayoutTableCacheEntry;
#define LAYOUTCACHE_ENTRIES 7
typedef struct TTLayoutTableCache {
TTLayoutTableCacheEntry entries[LAYOUTCACHE_ENTRIES];
void* kernPairs;
} TTLayoutTableCache;
#include "sunfontids.h"
JNIEXPORT extern TTLayoutTableCache* newLayoutTableCache();
JNIEXPORT extern void freeLayoutTableCache(TTLayoutTableCache* ltc);
/* If font is malformed then scaler context created by particular scaler
* will be replaced by null scaler context.
* Note that this context is not compatible with structure of the context

View File

@@ -131,6 +131,7 @@ typedef void (GLAPIENTRY *glViewportType)(GLint x, GLint y, GLsizei width, GLsiz
* extensions, which is why they are called out separately here)
*/
typedef void (GLAPIENTRY *glActiveTextureARBType)(GLenum texture);
typedef void (GLAPIENTRY *glClientActiveTextureType)(GLenum texture);
typedef void (GLAPIENTRY *glMultiTexCoord2fARBType)(GLenum texture, GLfloat s, GLfloat t);
typedef void (GLAPIENTRY *glTexImage3DType)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
@@ -290,6 +291,7 @@ typedef void (GLAPIENTRY *glTextureBarrierNVType) (void);
#define OGL_EXPRESS_EXT_FUNCS(action) \
OGL_##action##_EXT_FUNC(glActiveTextureARB); \
OGL_##action##_EXT_FUNC(glClientActiveTexture); \
OGL_##action##_EXT_FUNC(glMultiTexCoord2fARB); \
OGL_##action##_EXT_FUNC(glTexImage3D); \
OGL_##action##_EXT_FUNC(glBindRenderbufferEXT); \

View File

@@ -38,6 +38,7 @@
#include "OGLTextRenderer.h"
#include "OGLVertexCache.h"
#include "AccelGlyphCache.h"
#include "jni_util.h"
/**
* The following constants define the inner and outer bounds of the
@@ -712,21 +713,14 @@ OGLTR_UpdateCachedDestination(OGLSDOps *dstOps, GlyphInfo *ginfo,
}
static jboolean
OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps,
GlyphInfo *ginfo, jint x, jint y,
jint glyphIndex, jint totalGlyphs,
jboolean rgbOrder, jint contrast,
GLuint dstTextureID, jboolean * opened)
OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps, GlyphInfo *ginfo, jint x, jint y, jint glyphIndex,
jint totalGlyphs, jboolean rgbOrder, jint contrast, GLuint dstTextureID)
{
CacheCellInfo *cell;
jint dx1, dy1, dx2, dy2;
jfloat dtx1, dty1, dtx2, dty2;
if (glyphMode != MODE_USE_CACHE_LCD) {
if (*opened) {
*opened = JNI_FALSE;
j2d_glEnd();
}
OGLTR_DisableGlyphModeState();
CHECK_PREVIOUS_OP(GL_TEXTURE_2D);
j2d_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@@ -758,10 +752,6 @@ OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps,
}
if (ginfo->cellInfo == NULL) {
if (*opened) {
*opened = JNI_FALSE;
j2d_glEnd();
}
// rowBytes will always be a multiple of 3, so the following is safe
j2d_glPixelStorei(GL_UNPACK_ROW_LENGTH, ginfo->rowBytes / 3);
@@ -787,10 +777,6 @@ OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps,
dy2 = dy1 + ginfo->height;
if (dstTextureID == 0) {
if (*opened) {
*opened = JNI_FALSE;
j2d_glEnd();
}
// copy destination into second cached texture, if necessary
OGLTR_UpdateCachedDestination(dstOps, ginfo,
dx1, dy1, dx2, dy2,
@@ -818,23 +804,12 @@ OGLTR_DrawLCDGlyphViaCache(OGLContext *oglc, OGLSDOps *dstOps,
}
// render composed texture to the destination surface
if (!*opened) {
j2d_glBegin(GL_QUADS);
*opened = JNI_TRUE;
if (!OGLMTVertexCache_enable(oglc, dstTextureID != 0)) {
J2dTracePrimitive("OGLMTVertexCache_enable_failed");
return JNI_FALSE;
}
j2d_glMultiTexCoord2fARB(GL_TEXTURE0_ARB, cell->tx1, cell->ty1);
j2d_glMultiTexCoord2fARB(GL_TEXTURE1_ARB, dtx1, dty1);
j2d_glVertex2i(dx1, dy1);
j2d_glMultiTexCoord2fARB(GL_TEXTURE0_ARB, cell->tx2, cell->ty1);
j2d_glMultiTexCoord2fARB(GL_TEXTURE1_ARB, dtx2, dty1);
j2d_glVertex2i(dx2, dy1);
j2d_glMultiTexCoord2fARB(GL_TEXTURE0_ARB, cell->tx2, cell->ty2);
j2d_glMultiTexCoord2fARB(GL_TEXTURE1_ARB, dtx2, dty2);
j2d_glVertex2i(dx2, dy2);
j2d_glMultiTexCoord2fARB(GL_TEXTURE0_ARB, cell->tx1, cell->ty2);
j2d_glMultiTexCoord2fARB(GL_TEXTURE1_ARB, dtx1, dty2);
j2d_glVertex2i(dx1, dy2);
OGLMTVertexCache_addGlyphQuad(dx1, dy1, dx2, dy2, cell->tx1, cell->ty1,
cell->tx2, cell->ty2, dtx1, dty1, dtx2, dty2);
return JNI_TRUE;
}
@@ -1066,11 +1041,13 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
{
int glyphCounter;
GLuint dstTextureID = 0;
jboolean hasLCDGlyphs = JNI_FALSE;
jboolean lcdOpened = JNI_FALSE;
jint ox1 = INT_MIN;
jlong time;
J2dTraceLn(J2D_TRACE_INFO, "OGLTR_DrawGlyphList");
if (graphicsPrimitive_traceflags & J2D_PTRACE_TIME) {
J2dTracePrimitive("OGLTR_DrawGlyphList");
time = J2dTraceNanoTime();
}
RETURN_IF_NULL(oglc);
RETURN_IF_NULL(dstOps);
@@ -1138,10 +1115,7 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
}
if (ginfo->rowBytes == ginfo->width) {
if (lcdOpened) {
lcdOpened = JNI_FALSE;
j2d_glEnd();
}
OGLMTVertexCache_disable();
// grayscale or monochrome glyph data
if (ginfo->width <= OGLTR_CACHE_CELL_WIDTH &&
ginfo->height <= OGLTR_CACHE_CELL_HEIGHT)
@@ -1151,18 +1125,12 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
ok = OGLTR_DrawGrayscaleGlyphNoCache(oglc, ginfo, x, y);
}
} else if (ginfo->rowBytes == ginfo->width * 4) {
OGLMTVertexCache_disable();
// color glyph data
ok = OGLTR_DrawColorGlyphNoCache(oglc, ginfo, x, y);
} else {
// LCD-optimized glyph data
jint rowBytesOffset = 0;
if (!hasLCDGlyphs) {
// Flush GPU buffers before processing first LCD glyph
hasLCDGlyphs = JNI_TRUE;
if (dstTextureID != 0) {
j2d_glTextureBarrierNV();
}
}
if (subPixPos) {
jint frac = (jint)((glyphx - x) * 3);
@@ -1172,29 +1140,16 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
}
}
// Flush GPU buffers before processing overlapping LCD glyphs on OSX
if (dstTextureID != 0 && ox1 > x) {
if (lcdOpened) {
lcdOpened = JNI_FALSE;
j2d_glEnd();
}
j2d_glTextureBarrierNV();
}
if (rowBytesOffset == 0 &&
ginfo->width <= OGLTR_CACHE_CELL_WIDTH &&
ginfo->height <= OGLTR_CACHE_CELL_HEIGHT)
{
ok = OGLTR_DrawLCDGlyphViaCache(oglc, dstOps,
ginfo, x, y,
ok = OGLTR_DrawLCDGlyphViaCache(oglc, dstOps, ginfo, x, y,
glyphCounter, totalGlyphs,
rgbOrder, lcdContrast,
dstTextureID, &lcdOpened);
dstTextureID);
} else {
if (lcdOpened) {
lcdOpened = JNI_FALSE;
j2d_glEnd();
}
OGLMTVertexCache_disable();
ok = OGLTR_DrawLCDGlyphNoCache(oglc, dstOps,
ginfo, x, y,
rowBytesOffset,
@@ -1202,15 +1157,12 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
dstTextureID);
}
}
ox1 = x + ginfo->width;
if (!ok) {
break;
}
}
if (lcdOpened) {
j2d_glEnd();
}
OGLMTVertexCache_disable();
J2dTracePrimitiveTime("OGLTR_DrawGlyphList", time);
}
JNIEXPORT void JNICALL

View File

@@ -27,9 +27,11 @@
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include "sun_java2d_SunGraphics2D.h"
#include "jni_util.h"
#include "OGLPaints.h"
#include "OGLVertexCache.h"
@@ -39,11 +41,28 @@ typedef struct _J2DVertex {
jfloat dx, dy;
} J2DVertex;
// Multitexture vertex
typedef struct _J2DMTVertex {
jfloat dx, dy;
jfloat tx0, ty0;
jfloat tx1, ty1;
} J2DMTVertex;
static J2DVertex *vertexCache = NULL;
static jint vertexCacheIndex = 0;
static J2DMTVertex *mtVertexCache = NULL;
static jboolean mtVertexCacheEnabled = JNI_FALSE;
static jboolean mtUseTxtBarrier = JNI_FALSE;
static jint evenLCDGlyphInd = 0;
static jint oddLCDGlyphInd = ODD_LCD_GLYPHS_OFFSET;
static jint lcdGlyphInd = 0;
static jfloat evenOx2 = FLT_MIN;
static jfloat oddOx2 = FLT_MIN;
static GLuint maskCacheTexID = 0;
static jint maskCacheIndex = 0;
static void OGLMTVertexCache_flush(jint mask);
#define OGLVC_ADD_VERTEX(TX, TY, R, G, B, A, DX, DY) \
do { \
@@ -66,6 +85,25 @@ static jint maskCacheIndex = 0;
OGLVC_ADD_VERTEX(TX1, TY2, R, G, B, A, DX1, DY2); \
} while (0)
#define OGLMTVC_ADD_VERTEX(IND, DX, DY, TX0, TY0, TX1, TY1) \
do { \
J2DMTVertex *v = &mtVertexCache[IND++]; \
v->dx = DX; \
v->dy = DY; \
v->tx0 = TX0; \
v->ty0 = TY0; \
v->tx1 = TX1; \
v->ty1 = TY1; \
} while (0)
#define OGLMTVC_ADD_QUAD(IND, DX1, DY1, DX2, DY2, TX1, TY1, TX2, TY2, DTX1, DTY1, DTX2, DTY2) \
do { \
OGLMTVC_ADD_VERTEX((IND), DX1, DY1, TX1, TY1, DTX1, DTY1); \
OGLMTVC_ADD_VERTEX((IND), DX2, DY1, TX2, TY1, DTX2, DTY1); \
OGLMTVC_ADD_VERTEX((IND), DX2, DY2, TX2, TY2, DTX2, DTY2); \
OGLMTVC_ADD_VERTEX((IND), DX1, DY2, TX1, TY2, DTX1, DTY2); \
} while (0)
jboolean
OGLVertexCache_InitVertexCache(OGLContext *oglc)
{
@@ -287,4 +325,97 @@ OGLVertexCache_AddGlyphQuad(OGLContext *oglc,
oglc->r, oglc->g, oglc->b, oglc->a);
}
jboolean OGLMTVertexCache_enable(OGLContext *oglc, jboolean useTxtBarrier) {
mtUseTxtBarrier = useTxtBarrier;
if (mtVertexCache == NULL) {
mtVertexCache = (J2DMTVertex *)malloc(OGLMTVC_MAX_INDEX * sizeof(J2DMTVertex));
if (mtVertexCache == NULL) {
return JNI_FALSE;
}
}
if (!mtVertexCacheEnabled) {
oglc->vertexCacheEnabled = JNI_FALSE;
j2d_glVertexPointer(2, GL_FLOAT, sizeof(J2DMTVertex), &mtVertexCache[0].dx);
j2d_glEnableClientState(GL_VERTEX_ARRAY);
j2d_glClientActiveTexture(GL_TEXTURE1_ARB);
j2d_glTexCoordPointer(2, GL_FLOAT, sizeof(J2DMTVertex), &mtVertexCache[0].tx1);
j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
j2d_glClientActiveTexture(GL_TEXTURE0_ARB);
j2d_glTexCoordPointer(2, GL_FLOAT, sizeof(J2DMTVertex), &mtVertexCache[0].tx0);
j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
mtVertexCacheEnabled = JNI_TRUE;
evenLCDGlyphInd = 0;
oddLCDGlyphInd = ODD_LCD_GLYPHS_OFFSET;
lcdGlyphInd = 0;
}
return JNI_TRUE;
}
void OGLMTVertexCache_disable() {
if (mtVertexCacheEnabled) {
OGLMTVertexCache_flush(OGLMTVC_FLUSH_ALL);
mtVertexCacheEnabled = JNI_FALSE;
}
}
void OGLMTVertexCache_flush(jint mask) {
if (mtVertexCacheEnabled) {
if ((mask & OGLMTVC_FLUSH_EVEN) && evenLCDGlyphInd > 0) {
if (mtUseTxtBarrier) {
// TextureBarrierNV() will guarantee that writes have completed
// and caches have been invalidated before subsequent Draws are
// executed
j2d_glTextureBarrierNV();
evenOx2 = FLT_MIN;
}
j2d_glDrawArrays(GL_QUADS, 0, evenLCDGlyphInd);
evenLCDGlyphInd = 0;
}
if ((mask & OGLMTVC_FLUSH_ODD) && oddLCDGlyphInd > ODD_LCD_GLYPHS_OFFSET) {
if (mtUseTxtBarrier) {
// See the comment above
j2d_glTextureBarrierNV();
oddOx2 = FLT_MIN;
}
j2d_glDrawArrays(GL_QUADS, ODD_LCD_GLYPHS_OFFSET,
oddLCDGlyphInd - ODD_LCD_GLYPHS_OFFSET);
oddLCDGlyphInd = ODD_LCD_GLYPHS_OFFSET;
}
}
}
void OGLMTVertexCache_addGlyphQuad(jfloat dx1, jfloat dy1,
jfloat dx2, jfloat dy2,
jfloat tx1, jfloat ty1,
jfloat tx2, jfloat ty2,
jfloat dtx1, jfloat dty1,
jfloat dtx2, jfloat dty2)
{
jint* ind;
if (lcdGlyphInd & 0x1) {
if (oddLCDGlyphInd >= OGLMTVC_MAX_INDEX ||
(mtUseTxtBarrier && oddOx2 >= dx1))
{
OGLMTVertexCache_flush(OGLMTVC_FLUSH_ODD);
} else if (mtUseTxtBarrier) {
oddOx2 = dx2;
}
ind = &oddLCDGlyphInd;
} else {
if (evenLCDGlyphInd >= ODD_LCD_GLYPHS_OFFSET ||
(mtUseTxtBarrier && evenOx2 >= dx1))
{
OGLMTVertexCache_flush(OGLMTVC_FLUSH_EVEN);
} else if (mtUseTxtBarrier) {
evenOx2 = dx2;
}
ind = &evenLCDGlyphInd;
}
lcdGlyphInd++;
OGLMTVC_ADD_QUAD(*ind, dx1, dy1, dx2, dy2, tx1, ty1, tx2, ty2, dtx1, dty1, dtx2, dty2);
}
#endif /* !HEADLESS */

View File

@@ -30,9 +30,14 @@
#include "OGLContext.h"
/**
* Constants that control the size of the vertex cache.
* Constants that control the size of the vertex caches.
*/
#define OGLVC_MAX_INDEX 1024
#define OGLMTVC_MAX_INDEX 2048
#define ODD_LCD_GLYPHS_OFFSET (OGLMTVC_MAX_INDEX >> 1)
#define OGLMTVC_FLUSH_EVEN 1
#define OGLMTVC_FLUSH_ODD 2
#define OGLMTVC_FLUSH_ALL 3
/**
* Constants that control the size of the texture tile cache used for
@@ -83,4 +88,14 @@ void OGLVertexCache_AddGlyphQuad(OGLContext *oglc,
jfloat dx1, jfloat dy1,
jfloat dx2, jfloat dy2);
jboolean OGLMTVertexCache_enable(OGLContext *oglc, jboolean useTxtBarrier);
void OGLMTVertexCache_addGlyphQuad(jfloat dx1, jfloat dy1,
jfloat dx2, jfloat dy2,
jfloat tx1, jfloat ty1,
jfloat tx2, jfloat ty2,
jfloat dtx1, jfloat dty1,
jfloat dtx2, jfloat dty2);
void OGLMTVertexCache_disable();
#endif /* OGLVertexCache_h_Included */

View File

@@ -29,6 +29,9 @@
#include <jni.h>
#include "debug_trace.h"
#include "jni_util.h"
#ifdef __MACH__
#include <mach/mach_time.h>
#endif
#ifdef __cplusplus
extern "C" {
@@ -53,6 +56,8 @@ JNIEXPORT extern jint graphicsPrimitive_traceflags;
#define J2D_TRACE_VERBOSE2 5
#define J2D_TRACE_MAX (J2D_TRACE_VERBOSE2+1)
#define J2D_PTRACE_TIME 8
JNIEXPORT void JNICALL
J2dTraceImpl(int level, jboolean cr, const char *string, ...);
JNIEXPORT void JNICALL
@@ -182,13 +187,41 @@ J2dTraceInit();
if (graphicsPrimitive_traceflags && jvm) { \
void *env; \
jstring jstr; \
(*jvm)->AttachCurrentThreadAsDaemon(jvm, &env, NULL); \
(*jvm)->AttachCurrentThreadAsDaemon(jvm, (void**)&env, NULL); \
jstr = (*(JNIEnv*)env)->NewStringUTF(env, string); \
JNU_CallStaticMethodByName(env, NULL, "sun/java2d/loops/GraphicsPrimitive", \
"tracePrimitive", "(Ljava/lang/Object;)V", jstr); \
JNU_CallStaticMethodByName( \
env, NULL, "sun/java2d/loops/GraphicsPrimitive", \
"tracePrimitive", "(Ljava/lang/Object;)V", jstr); \
(*(JNIEnv*)env)->DeleteLocalRef(env, jstr); \
} \
}
#ifdef __MACH__
#define J2dTraceNanoTime() (mach_absolute_time())
#define J2dTracePrimitiveTime(string,t0) { \
if ((graphicsPrimitive_traceflags & J2D_PTRACE_TIME) && jvm) { \
JNIEnv *env; \
jstring jstr; \
static mach_timebase_info_data_t ti; \
jlong t1; \
t1 = mach_absolute_time(); \
if (ti.denom == 0) { \
(void) mach_timebase_info(&ti); \
} \
(*jvm)->AttachCurrentThreadAsDaemon(jvm, &env, NULL); \
jstr = (*env)->NewStringUTF(env, string); \
JNU_CallStaticMethodByName(env, NULL, "sun/java2d/loops/GraphicsPrimitive", \
"tracePrimitiveTime", "(Ljava/lang/Object;J)V", jstr,\
(((t1-t0)*ti.numer)/ti.denom)); \
(*env)->DeleteLocalRef(env, jstr); \
} \
}
#else
#define J2dTracePrimitiveTime(string,t)
#define J2dTraceNanoTime() (0)
#endif
#ifdef __cplusplus
};
#endif /* __cplusplus */

View File

@@ -238,8 +238,8 @@ JNIEXPORT jboolean JNICALL Java_sun_font_SunLayoutEngine_shape
jobject fontStrike,
jfloat ptSize,
jfloatArray matrix,
jlong pFace,
jlong pNativeFont,
jlong pFace,
jboolean aat,
jcharArray text,
jobject gvdata,

View File

@@ -111,7 +111,6 @@ typedef struct {
unsigned fontDataOffset;
unsigned fontDataLength;
unsigned fileSize;
TTLayoutTableCache* layoutTables;
} FTScalerInfo;
typedef struct FTScalerContext {
@@ -494,7 +493,6 @@ Java_sun_font_FreetypeFontScaler_initNativeScaler(
if (type == TYPE1_FROM_JAVA) { /* TYPE1 */
scalerInfo->fontData = (unsigned char*) malloc(filesize);
scalerInfo->directBuffer = NULL;
scalerInfo->layoutTables = NULL;
scalerInfo->fontDataLength = filesize;
if (scalerInfo->fontData != NULL) {
@@ -1343,32 +1341,6 @@ Java_sun_font_FreetypeFontScaler_getGlyphImageNative(
return ptr_to_jlong(glyphInfo);
}
/*
* Class: sun_font_FreetypeFontScaler
* Method: getLayoutTableCacheNative
* Signature: (J)J
*/
JNIEXPORT jlong JNICALL
Java_sun_font_FreetypeFontScaler_getLayoutTableCacheNative(
JNIEnv *env, jobject scaler, jlong pScaler) {
FTScalerInfo *scalerInfo = (FTScalerInfo*) jlong_to_ptr(pScaler);
if (scalerInfo == NULL) {
invalidateJavaScaler(env, scaler, scalerInfo);
return 0L;
}
// init layout table cache in font
// we're assuming the font is a file font and moreover it is Truetype font
// otherwise we shouldn't be able to get here...
if (scalerInfo->layoutTables == NULL) {
scalerInfo->layoutTables = newLayoutTableCache();
}
return ptr_to_jlong(scalerInfo->layoutTables);
}
/*
* Class: sun_font_FreetypeFontScaler
* Method: disposeNativeScaler

View File

@@ -24,7 +24,8 @@
*/
#include "jlong.h"
#include "sun_font_Font2D.h"
#include "sun_font_SunLayoutEngine.h"
#include "hb.h"
#include "hb-jdk.h"
#ifdef MACOSX
@@ -283,6 +284,9 @@ _hb_jdk_get_font_funcs (void)
static void _do_nothing(void) {
}
static void _free_nothing(void*) {
}
struct Font2DPtr {
JavaVM* vmPtr;
jweak font2DRef;
@@ -295,7 +299,7 @@ static void cleanupFontInfo(void* data) {
fontInfo = (Font2DPtr*) data;
fontInfo->vmPtr->GetEnv((void**)&env, JNI_VERSION_1_1);
env->DeleteWeakGlobalRef(fontInfo->font2DRef);
free((void*)data);
free(data);
}
static hb_blob_t *
@@ -305,7 +309,13 @@ reference_table(hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) {
JNIEnv* env;
jobject font2D;
jsize length;
jbyte* buffer;
void* buffer;
// HB_TAG_NONE is 0 and is used to get the whole font file.
// It is not expected to be needed for JDK.
if (tag == 0) {
return NULL;
}
fontInfo = (Font2DPtr*)user_data;
fontInfo->vmPtr->GetEnv((void**)&env, JNI_VERSION_1_1);
@@ -314,31 +324,32 @@ reference_table(hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) {
}
font2D = fontInfo->font2DRef;
// HB_TAG_NONE is 0 and is used to get the whole font file.
// It is not expected not be needed for JDK.
if (tag == 0) {
return NULL;
}
jbyteArray tableBytes = (jbyteArray)
env->CallObjectMethod(font2D, sunFontIDs.getTableBytesMID, tag);
if (tableBytes == NULL) {
return NULL;
}
length = env->GetArrayLength(tableBytes);
buffer = (jbyte *)calloc(length, sizeof(jbyte));
env->GetByteArrayRegion(tableBytes, 0, length, buffer);
buffer = calloc(length, sizeof(jbyte));
env->GetByteArrayRegion(tableBytes, 0, length, (jbyte*)buffer);
return hb_blob_create((const char *)buffer, length,
HB_MEMORY_MODE_WRITABLE,
buffer, free);
}
extern "C" {
/*
* Class: sun_font_Font2D
* Method: createHarfbuzzFace
* Signature: (ZJ)J
* Class: sun_font_SunLayoutEngine
* Method: createFace
* Signature: (Lsun/font/Font2D;ZJJ)J
*/
JNIEXPORT jlong JNICALL Java_sun_font_Font2D_createHarfbuzzFace(JNIEnv *env, jobject font2D, jboolean aat, jlong platformFontPtr) {
JNIEXPORT jlong JNICALL Java_sun_font_SunLayoutEngine_createFace(JNIEnv *env,
jclass cls,
jobject font2D,
jboolean aat,
jlong platformFontPtr) {
#ifdef MACOSX
if (aat && platformFontPtr) {
hb_face_t *face = hb_coretext_face_create((CGFontRef)platformFontPtr);
@@ -353,20 +364,29 @@ JNIEXPORT jlong JNICALL Java_sun_font_Font2D_createHarfbuzzFace(JNIEnv *env, job
env->GetJavaVM(&vmPtr);
fi->vmPtr = vmPtr;
fi->font2DRef = env->NewWeakGlobalRef(font2D);
hb_face_t *face = hb_face_create_for_tables(reference_table, fi, cleanupFontInfo);
if (!fi->font2DRef) {
free(fi);
return 0;
}
hb_face_t *face = hb_face_create_for_tables(reference_table, fi,
cleanupFontInfo);
return ptr_to_jlong(face);
}
/*
* Class: sun_font_Font2D
* Method: disposeHarfbuzzFace
* Class: sun_font_SunLayoutEngine
* Method: disposeFace
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_sun_font_Font2D_disposeHarfbuzzFace(JNIEnv *env, jclass cls, jlong ptr) {
JNIEXPORT void JNICALL Java_sun_font_SunLayoutEngine_disposeFace(JNIEnv *env,
jclass cls,
jlong ptr) {
hb_face_t* face = (hb_face_t*) jlong_to_ptr(ptr);
hb_face_destroy(face);
}
} // extern "C"
static hb_font_t* _hb_jdk_font_create(hb_face_t* face,
JDKFontInfo *jdkFontInfo,
hb_destroy_func_t destroy) {
@@ -384,7 +404,8 @@ static hb_font_t* _hb_jdk_font_create(hb_face_t* face,
}
#ifdef MACOSX
static hb_font_t* _hb_jdk_ct_font_create(hb_face_t* face, JDKFontInfo *jdkFontInfo) {
static hb_font_t* _hb_jdk_ct_font_create(hb_face_t* face,
JDKFontInfo *jdkFontInfo) {
hb_font_t *font = NULL;
font = hb_font_create(face);
@@ -395,19 +416,13 @@ static hb_font_t* _hb_jdk_ct_font_create(hb_face_t* face, JDKFontInfo *jdkFontIn
}
#endif
hb_font_t* hb_jdk_font_create(hb_face_t* hbface,
JDKFontInfo *jdkFontInfo,
hb_font_t* hb_jdk_font_create(hb_face_t* hbFace,
JDKFontInfo *jdkFontInfo,
hb_destroy_func_t destroy) {
hb_font_t* font = NULL;
#ifdef MACOSX
if (jdkFontInfo->aat && jdkFontInfo->nativeFont) {
font = _hb_jdk_ct_font_create(hbface, jdkFontInfo);
return _hb_jdk_ct_font_create(hbFace, jdkFontInfo);
}
#endif
if (font == NULL) {
font = _hb_jdk_font_create(hbface, jdkFontInfo, destroy);
}
return font;
return _hb_jdk_font_create(hbFace, jdkFontInfo, destroy);
}

View File

@@ -63,7 +63,7 @@ hb_face_t *
hb_jdk_face_create(JDKFontInfo* jdkFontInfo,
hb_destroy_func_t destroy);
hb_font_t *
hb_jdk_font_create(hb_face_t* hbface,
hb_jdk_font_create(hb_face_t* hbFace,
JDKFontInfo* jdkFontInfo,
hb_destroy_func_t destroy);

View File

@@ -344,32 +344,3 @@ Java_sun_font_StrikeCache_getGlyphCacheDescription
(*env)->ReleasePrimitiveArrayCritical(env, results, nresults, 0);
}
JNIEXPORT TTLayoutTableCache* newLayoutTableCache() {
TTLayoutTableCache* ltc = calloc(1, sizeof(TTLayoutTableCache));
if (ltc) {
int i;
for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
ltc->entries[i].len = -1;
}
ltc->entries[0].tag = GDEF_TAG;
ltc->entries[1].tag = GPOS_TAG;
ltc->entries[2].tag = GSUB_TAG;
ltc->entries[3].tag = HEAD_TAG;
ltc->entries[4].tag = KERN_TAG;
ltc->entries[5].tag = MORT_TAG;
ltc->entries[6].tag = MORX_TAG;
}
return ltc;
}
JNIEXPORT void freeLayoutTableCache(TTLayoutTableCache* ltc) {
if (ltc) {
int i;
for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
if(ltc->entries[i].ptr) free (ltc->entries[i].ptr);
}
if (ltc->kernPairs) free(ltc->kernPairs);
free(ltc);
}
}

View File

@@ -586,17 +586,21 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
return false;
}
x = (int)(xclient.get_data(2) >> 16);
y = (int)(xclient.get_data(2) & 0xFFFF);
XWindow xwindow = null;
{
XBaseWindow xbasewindow = XToolkit.windowToXWindow(xclient.get_window());
if (xbasewindow instanceof XWindow) {
xwindow = (XWindow)xbasewindow;
// xclient can be a system-generated or a sent event (see XDragSourceContextPeer)
// so x/y is expected to be presented in device space
x = xbasewindow.scaleDown(x);
y = xbasewindow.scaleDown(y);
}
}
x = (int)(xclient.get_data(2) >> 16);
y = (int)(xclient.get_data(2) & 0xFFFF);
if (xwindow == null) {
long receiver =
XDropTargetRegistry.getRegistry().getEmbeddedDropSite(
@@ -620,7 +624,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
/* Time stamp - new in XDnD version 1. */
if (sourceProtocolVersion > 0) {
time_stamp = xclient.get_data(3);
time_stamp = xclient.get_data(3) & 0xFFFFFFFFL;
}
/* User action - new in XDnD version 2. */
@@ -867,7 +871,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
*/
if (dropAction == DnDConstants.ACTION_MOVE && success) {
long time_stamp = xclient.get_data(2);
long time_stamp = xclient.get_data(2) & 0xFFFFFFFFL;
long xdndSelectionAtom =
XDnDConstants.XDnDSelection.getSelectionAtom().getAtom();

View File

@@ -524,8 +524,9 @@ public final class XDragSourceContextPeer
updateTargetWindow(xmotion);
if (dragProtocol != null) {
dragProtocol.sendMoveMessage(scaleDown(xmotion.get_x_root()),
scaleDown(xmotion.get_y_root()),
// XDnDDropTargetProtocol.processXdndPosition will scale x/y
dragProtocol.sendMoveMessage(xmotion.get_x_root(),
xmotion.get_y_root(),
sourceAction, sourceActions,
xmotion.get_time());
}
@@ -533,8 +534,9 @@ public final class XDragSourceContextPeer
private void processDrop(XButtonEvent xbutton) {
try {
dragProtocol.initiateDrop(scaleDown(xbutton.get_x_root()),
scaleDown(xbutton.get_y_root()),
// XDnDDropTargetProtocol.processXdndPosition will scale x/y
dragProtocol.initiateDrop(xbutton.get_x_root(),
xbutton.get_y_root(),
sourceAction, sourceActions,
xbutton.get_time());
} catch (XException e) {

View File

@@ -72,6 +72,17 @@ public class XInputMethod extends X11InputMethod {
return createXICNative(peer.getContentWindow());
}
protected boolean recreateXIC() {
final XComponentPeer peer = (XComponentPeer)getPeer(clientComponentWindow);
if (peer == null || pData == 0)
return true;
return recreateXICNative(peer.getContentWindow(), pData);
}
protected void releaseXIC() {
if (pData == 0)
return;
releaseXICNative(pData);
}
private static volatile long xicFocus = 0;
@@ -150,6 +161,8 @@ public class XInputMethod extends X11InputMethod {
*/
private native boolean openXIMNative(long display);
private native boolean createXICNative(long window);
private native boolean recreateXICNative(long window, long px11data);
private native void releaseXICNative(long px11data);
private native void setXICFocusNative(long window,
boolean value, boolean active);
private native void adjustStatusWindow(long window);

View File

@@ -208,7 +208,7 @@ public class XMSelection {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("client messags = " + xce);
}
long timestamp = xce.get_data(0);
long timestamp = xce.get_data(0) & 0xFFFFFFFFL;
long atom = xce.get_data(1);
long owner = xce.get_data(2);
long data = xce.get_data(3);

View File

@@ -25,6 +25,9 @@
package sun.awt;
import java.util.List;
import java.util.ArrayList;
import java.awt.AWTException;
import java.awt.event.InputMethodEvent;
import java.awt.font.TextAttribute;
@@ -40,6 +43,7 @@ import sun.util.logging.PlatformLogger;
* @author JavaSoft International
*/
public abstract class X11InputMethod extends X11InputMethodBase {
protected static final List<X11InputMethod> activeInputMethods = new ArrayList<X11InputMethod>();
/**
* Constructs an X11InputMethod instance. It initializes the XIM
@@ -85,6 +89,9 @@ public abstract class X11InputMethod extends X11InputMethodBase {
if (!createXIC()) {
return;
}
awtLock();
activeInputMethods.add(this);
awtUnlock();
disposed = false;
}
@@ -329,6 +336,7 @@ public abstract class X11InputMethod extends X11InputMethodBase {
protected synchronized void disposeImpl() {
disposeXIC();
awtLock();
activeInputMethods.remove(this);
composedText = null;
committedText = null;
rawFeedbacks = null;
@@ -353,4 +361,22 @@ public abstract class X11InputMethod extends X11InputMethodBase {
savedCompositionState = enable;
}
}
static void recreateAllXIC() {
// NOTE: called from native within AWT_LOCK
for (X11InputMethod im : activeInputMethods)
im.releaseXIC();
if (!recreateX11InputMethod()) {
log.warning("can't recreate X11 InputMethod");
return;
}
for (X11InputMethod im : activeInputMethods) {
if (!im.recreateXIC())
log.warning("can't recreate XIC for " + im.toString());
}
}
protected abstract boolean recreateXIC();
protected abstract void releaseXIC();
private static native boolean recreateX11InputMethod();
}

View File

@@ -342,13 +342,8 @@ static void setX11InputMethodData(JNIEnv * env, jobject imInstance, X11InputMeth
JNU_SetLongFieldFromPtr(env, imInstance, x11InputMethodIDs.pData, pX11IMData);
}
/* this function should be called within AWT_LOCK() */
static void
destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
{
/*
* Destroy XICs
*/
destroyXInputContexts(X11InputMethodData *pX11IMData) {
if (pX11IMData == NULL) {
return;
}
@@ -365,7 +360,20 @@ destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
pX11IMData->current_ic = (XIC)0;
}
}
}
/* this function should be called within AWT_LOCK() */
static void
destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
{
/*
* Destroy XICs
*/
if (pX11IMData == NULL) {
return;
}
destroyXInputContexts(pX11IMData);
freeX11InputMethodData(env, pX11IMData);
}
@@ -1364,6 +1372,27 @@ finally:
return (pX11IMData != NULL);
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_X11_XInputMethod_recreateXICNative(JNIEnv *env,
jobject this,
jlong window, jlong pData)
{
// NOTE: must be called under AWT_LOCK
return createXIC(env, (X11InputMethodData *)pData, window);
}
JNIEXPORT void JNICALL
Java_sun_awt_X11_XInputMethod_releaseXICNative(JNIEnv *env,
jobject this,
jlong pData)
{
// NOTE: must be called under AWT_LOCK
X11InputMethodData * pX11IMData = (X11InputMethodData *)pData;
pX11IMData->current_ic = NULL;
destroyXInputContexts(pX11IMData);
}
JNIEXPORT void JNICALL
Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
jobject this,
@@ -1616,3 +1645,21 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow
AWT_UNLOCK();
#endif
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_X11InputMethod_recreateX11InputMethod(JNIEnv *env, jclass cls)
{
if (X11im == NULL || dpy == NULL)
return JNI_FALSE;
Status retstat = XCloseIM(X11im);
X11im = XOpenIM(dpy, NULL, NULL, NULL);
if (X11im == NULL)
return JNI_FALSE;
XIMCallback ximCallback;
ximCallback.callback = (XIMProc)DestroyXIMCallback;
ximCallback.client_data = NULL;
XSetIMValues(X11im, XNDestroyCallback, &ximCallback, NULL);
return JNI_TRUE;
}

View File

@@ -324,6 +324,8 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
/* GDK */
fp_gdk_get_default_root_window =
dl_symbol("gdk_get_default_root_window");
fp_gdk_window_get_scale_factor =
dl_symbol("gdk_window_get_scale_factor");
/* Pixbuf */
fp_gdk_pixbuf_new = dl_symbol("gdk_pixbuf_new");
@@ -2869,7 +2871,10 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
jint *ary;
GdkWindow *root = (*fp_gdk_get_default_root_window)();
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(root, x, y, width, height);
int win_scale = (*fp_gdk_window_get_scale_factor)(root);
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
root, x, y, (int)(width / (float)win_scale + 0.5), (int)(height / (float)win_scale + 0.5));
if (pixbuf && scale != 1) {
GdkPixbuf *scaledPixbuf;
x /= scale;
@@ -2887,8 +2892,8 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
if (pixbuf) {
int nchan = (*fp_gdk_pixbuf_get_n_channels)(pixbuf);
int stride = (*fp_gdk_pixbuf_get_rowstride)(pixbuf);
if ((*fp_gdk_pixbuf_get_width)(pixbuf) == width
&& (*fp_gdk_pixbuf_get_height)(pixbuf) == height
if ((*fp_gdk_pixbuf_get_width)(pixbuf) >= width
&& (*fp_gdk_pixbuf_get_height)(pixbuf) >= height
&& (*fp_gdk_pixbuf_get_bits_per_sample)(pixbuf) == 8
&& (*fp_gdk_pixbuf_get_colorspace)(pixbuf) == GDK_COLORSPACE_RGB
&& nchan >= 3

View File

@@ -253,6 +253,7 @@ static gchar* (*fp_gtk_check_version)(guint required_major, guint
static void (*fp_g_free)(gpointer mem);
static void (*fp_g_object_unref)(gpointer object);
static GdkWindow *(*fp_gdk_get_default_root_window) (void);
static int (*fp_gdk_window_get_scale_factor) (GdkWindow *window);
static int (*fp_gdk_pixbuf_get_bits_per_sample)(const GdkPixbuf *pixbuf);
static guchar *(*fp_gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf);

View File

@@ -644,6 +644,55 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XWindowEvent
XWindowEvent( (Display *) jlong_to_ptr(display), (Window)window, event_mask, (XEvent *) jlong_to_ptr(event_return));
}
static int filteredEventsCount = 0;
static int filteredEventsThreshold = -1;
#define KeyPressEventType 2
#define KeyReleaseEventType 3
static void checkBrokenInputMethod(XEvent * event, jboolean isEventFiltered) {
if (filteredEventsThreshold < 0) {
filteredEventsThreshold = 0;
// read from VM-property
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jclass systemCls = (*env)->FindClass(env, "java/lang/System");
CHECK_NULL(systemCls);
jmethodID mid = (*env)->GetStaticMethodID(env, systemCls, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;");
CHECK_NULL(mid);
jstring name = (*env)->NewStringUTF(env, "recreate.x11.input.method");
CHECK_NULL(name);
jstring jvalue = (*env)->CallStaticObjectMethod(env, systemCls, mid, name);
if (jvalue != NULL) {
const char * utf8string = (*env)->GetStringUTFChars(env, jvalue, NULL);
if (utf8string != NULL) {
const int parsedVal = atoi(utf8string);
if (parsedVal > 0)
filteredEventsThreshold = parsedVal;
else if (strncmp(utf8string, "true", 4) == 0)
filteredEventsThreshold = 10;
}
(*env)->ReleaseStringUTFChars(env, jvalue, utf8string);
}
(*env)->DeleteLocalRef(env, name);
}
if (filteredEventsThreshold <= 0)
return;
if (event->type == KeyPressEventType || event->type == KeyReleaseEventType) {
if (isEventFiltered) {
filteredEventsCount++;
} else {
filteredEventsCount = 0;
}
if (filteredEventsCount > filteredEventsThreshold) {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11InputMethod", "recreateAllXIC", "()V");
filteredEventsCount = 0;
}
}
}
/*
* Class: sun_awt_X11_XlibWrapper
* Method: XFilterEvent
@@ -658,7 +707,9 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XFilterEvent
return (jboolean)True;
}
#endif
return (jboolean) XFilterEvent((XEvent *) jlong_to_ptr(ptr), (Window) window);
jboolean isEventFiltered = (jboolean) XFilterEvent((XEvent *) jlong_to_ptr(ptr), (Window) window);
checkBrokenInputMethod((XEvent *)jlong_to_ptr(ptr), isEventFiltered);
return isEventFiltered;
}
/*

View File

@@ -1720,7 +1720,7 @@ void GetSysInsets(RECT* insets, AwtFrame* pFrame) {
int dpi = device ? device->GetScaleX() * 96 : 96;
// GetSystemMetricsForDpi gives incorrect values, use AdjustWindowRectExForDpi for border metrics instead
RECT rect = {0};
RECT rect = {};
DWORD style = pFrame->IsResizable() ? WS_OVERLAPPEDWINDOW : WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME;
AwtToolkit::AdjustWindowRectExForDpi(&rect, style, FALSE, NULL, dpi);
::SetRect(insets, -rect.left, -rect.top, rect.right, rect.bottom);
@@ -1734,7 +1734,7 @@ LRESULT HitTestNCA(AwtFrame* frame, int x, int y) {
GetWindowRect(frame->GetHWnd(), &rcWindow);
// Get the frame rectangle, adjusted for the style without a caption.
RECT rcFrame = {0};
RECT rcFrame = {};
AdjustWindowRectEx(&rcFrame, WS_OVERLAPPEDWINDOW & ~WS_CAPTION, FALSE, NULL);
USHORT uRow = 1;
@@ -1787,18 +1787,23 @@ MsgRouting AwtFrame::WmNcCalcSize(BOOL wParam, LPNCCALCSIZE_PARAMS lpncsp, LRESU
GetSysInsets(&insets, this);
RECT* rect = &lpncsp->rgrc[0];
rect->left = rect->left + insets.left;
rect->left += insets.left;
rect->right -= insets.right;
rect->bottom -= insets.bottom;
if (::IsZoomed(GetHWnd())) {
lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + insets.bottom;
rect->top += insets.bottom;
// [moklev] Workaround for RIDER-27069, IDEA-211327
if (!this->IsUndecorated()) {
rect->right += this->ScaleUpX(1);
rect->bottom -= 1;
}
}
else {
// this makes the native caption go uncovered
// int yBorder = ::GetSystemMetrics(SM_CYBORDER);
// lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + yBorder;
// rect->top += yBorder;
}
rect->right = rect->right - insets.right;
rect->bottom = rect->bottom - insets.bottom;
retVal = 0L;
return mrConsume;
}

View File

@@ -1404,7 +1404,19 @@ void AwtWindow::Show()
if (nCmdShow == SW_SHOWNA) {
flags |= SWP_NOACTIVATE;
}
::SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, flags);
// This flag allows the toplevel to be bellow other process toplevels.
// This behaviour is preferable for popups, but it is not appropriate
// for menus
BOOL isLightweightDialog = TRUE;
jclass windowPeerClass = env->FindClass("java/awt/peer/WindowPeer");
if (windowPeerClass != NULL) {
jmethodID isLightweightDialogMID = env->GetStaticMethodID(windowPeerClass, "isLightweightDialog", "(Ljava/awt/Window;)Z");
if (isLightweightDialogMID != NULL) {
isLightweightDialog = env->CallStaticBooleanMethod(windowPeerClass, isLightweightDialogMID, target);
}
}
::SetWindowPos(GetHWnd(), isLightweightDialog ? HWND_TOP : HWND_TOPMOST, 0, 0, 0, 0, flags);
} else {
::ShowWindow(GetHWnd(), nCmdShow);
}

View File

@@ -103,16 +103,21 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
Type findType(String signature) throws ClassNotLoadedException {
List<ReferenceType> types = visibleClasses();
Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) {
ReferenceType type = iter.next();
// first check already loaded classes and possibly avoid massive signature retrieval later
String typeName = new JNITypeParser(signature).typeName();
for (ReferenceType type : vm.classesByName(typeName)) {
if (types.contains(type)) {
return type;
}
}
for (ReferenceType type : types) {
if (type.signature().equals(signature)) {
return type;
}
}
JNITypeParser parser = new JNITypeParser(signature);
throw new ClassNotLoadedException(parser.typeName(),
"Class " + parser.typeName() + " not loaded");
throw new ClassNotLoadedException(typeName, "Class " + typeName + " not loaded");
}
byte typeValueKey() {

View File

@@ -61,6 +61,9 @@ applications/ctw/modules/jdk_jconsole.java 8189604 windows-all
compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all
compiler/uncommontrap/DeoptReallocFailure.java nobug generic-all causes Out of memory: Java heap space affects run status
compiler/uncommontrap/TestDeoptOOM.java nobug generic-all causes Out of memory: Java heap space affects run status
#############################################################################
# :hotspot_gc

View File

@@ -38,9 +38,12 @@ import javax.swing.UIManager;
* @bug 8073320
* @summary Windows HiDPI support
* @author Alexander Scherbatiy
* @requires (os.family == "windows")
* @requires (os.family == "linux" | os.family == "windows")
* @run main/othervm -Dsun.java2d.win.uiScaleX=3 -Dsun.java2d.win.uiScaleY=2
* HiDPIRobotScreenCaptureTest
HiDPIRobotScreenCaptureTest
* @run main/othervm -Dsun.java2d.uiScale=1 HiDPIRobotScreenCaptureTest
* @run main/othervm -Dsun.java2d.uiScale=2 HiDPIRobotScreenCaptureTest
* @run main/othervm -Dsun.java2d.uiScale=3 HiDPIRobotScreenCaptureTest
*/
public class HiDPIRobotScreenCaptureTest {
@@ -50,11 +53,13 @@ public class HiDPIRobotScreenCaptureTest {
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
return;
if (System.getProperty("os.name").toLowerCase().contains("win")) {
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
return;
}
}
Frame frame = new Frame();

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2000-2019 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @test
* @bug 8220231
* @summary Cache HarfBuzz face object for same font's text layout calls
* @comment Test layout operations for the same font performed simultaneously
* from multiple threads
*/
import java.awt.Font;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicReference;
public class FontLayoutStressTest {
private static final int NUMBER_OF_THREADS =
Runtime.getRuntime().availableProcessors() * 2;
private static final long TIME_TO_RUN_NS = 1_000_000_000; // 1 second
private static final Font FONT = new Font(Font.SERIF, Font.PLAIN, 12);
private static final FontRenderContext FRC = new FontRenderContext(null,
false, false);
private static final char[] TEXT = "Lorem ipsum dolor sit amet, ..."
.toCharArray();
private static double doLayout() {
GlyphVector gv = FONT.layoutGlyphVector(FRC, TEXT, 0, TEXT.length,
Font.LAYOUT_LEFT_TO_RIGHT);
return gv.getGlyphPosition(gv.getNumGlyphs()).getX();
}
public static void main(String[] args) throws Throwable {
double expectedWidth = doLayout();
AtomicReference<Throwable> throwableRef = new AtomicReference<>();
CyclicBarrier barrier = new CyclicBarrier(NUMBER_OF_THREADS);
List<Thread> threads = new ArrayList<>();
for (int i = 0; i < NUMBER_OF_THREADS; i++) {
Thread thread = new Thread(() -> {
try {
barrier.await();
long timeToStop = System.nanoTime() + TIME_TO_RUN_NS;
while (System.nanoTime() < timeToStop) {
double width = doLayout();
if (width != expectedWidth) {
throw new RuntimeException(
"Unexpected layout result");
}
}
} catch (Throwable e) {
throwableRef.set(e);
}
});
threads.add(thread);
thread.start();
}
for (Thread thread : threads) {
thread.join();
}
Throwable throwable = throwableRef.get();
if (throwable != null) {
throw throwable;
}
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright 2000-2019 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import javax.swing.*;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
/*
* @test
* @summary JBR-1604 Tooltip with package's info is cut
*/
public class JEditorPanePreferredSizeTest2 {
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
final Dimension size = new Dimension();
SwingUtilities.invokeAndWait(() -> {
JEditorPane editorPane = new JEditorPane("text/html", "text");
editorPane.setBorder(null);
editorPane.getPreferredSize();
editorPane.setText("another text");
size.setSize(editorPane.getPreferredSize());
});
if (size.width <= 0 || size.height <= 0) {
throw new RuntimeException("Test FAILED: bad preferred size: " + size);
}
}
}

View File

@@ -193,7 +193,7 @@ java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThr
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.html 8202926 generic-all
java/awt/Focus/WrongKeyTypedConsumedTest/WrongKeyTypedConsumedTest.java 8169096,8213522 macosx-all,linux-all,windows-all
java/awt/FontMetrics/FontCrash.java 8198336 windows-all
java/awt/Frame/DisposeParentGC/DisposeParentGC.java 8079786 macosx-all
java/awt/Frame/DisposeParentGC/DisposeParentGC.java 8079786,8055833 macosx-all,linux-all
java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java 8198237 macosx-all
java/awt/Frame/FramesGC/FramesGC.java 8079069 macosx-all
java/awt/Frame/InvisibleOwner/InvisibleOwner.java 8169111 macosx-all,windows-all
@@ -223,7 +223,7 @@ java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java
java/awt/GridLayout/LayoutExtraGaps/LayoutExtraGaps.java 8000171 windows-all
java/awt/JAWT/JAWT.sh 8197798 windows-all
java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.html JRE-898 macosx-all,linux-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java 8198623 macosx-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java 8198623 macosx-all,windows-all,linux-all
java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java 8198623 macosx-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html 8198624 macosx-all,linux-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html 8198626 macosx-all,windows-all
@@ -529,7 +529,7 @@ java/awt/Modal/ToFront/FrameToFrontTKModal3Test.java
java/awt/Modal/ToFront/FrameToFrontTKModal4Test.java 8196441 macosx-all,windows-all,linux-all
java/awt/Modal/ToFront/FrameToFrontTKModal5Test.java 8196441 macosx-all,windows-all,linux-all
java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java 8177326 macosx-all,windows-all
java/awt/Mouse/EnterExitEvents/DragWindowTest.java 8023562 macosx-all,windows-all
java/awt/Mouse/EnterExitEvents/DragWindowTest.java 8023562 macosx-all,windows-all,linux-all
java/awt/Mouse/EnterExitEvents/ModalDialogEnterExitEventsTest.java JRE-898 macosx-all,windows-all,linux-all
java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java 8005021 macosx-all,windows-all,linux-all
java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java 8051455 macosx-all
@@ -599,7 +599,7 @@ java/awt/Window/AlwaysOnTop/AutoTestOnTop.java
java/awt/Window/AlwaysOnTop/TestAlwaysOnTopBeforeShow.java 8169530 macosx-all,windows-all
java/awt/Window/GrabSequence/GrabSequence.java 6848409 macosx-all,windows-all,linux-all
java/awt/Window/LocationAtScreenCorner/LocationAtScreenCorner.java 8203371 linux-all,solaris-all
java/awt/Window/setLocRelativeTo/SetLocationRelativeToTest.java JRE-1173 windows-all
java/awt/Window/setLocRelativeTo/SetLocationRelativeToTest.java JRE-1173 windows-all,linux-all
java/awt/datatransfer/ConstructFlavoredObjectTest/ConstructFlavoredObjectTest.java 8202860 linux-all
java/awt/datatransfer/DataFlavor/DataFlavorRemoteTest.java JRE-898 macosx-all
java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java 8080982 generic-all
@@ -618,6 +618,7 @@ java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java
java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html 8214221 windows-all,linux-all,macosx-all
java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.html 8171510 macosx-all
java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html 8194947 generic-all
java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.html 6511207 generic-all
java/awt/event/HierarchyEvent/AncestorResized/AncestorResized.java 6618538 generic-all
java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all
java/awt/event/KeyEvent/CorrectTime/CorrectTime.java 6626492 generic-all
@@ -984,7 +985,7 @@ javax/swing/JPopupMenu/6515446/bug6515446.java
javax/swing/JPopupMenu/6580930/bug6580930.java 8196096 windows-all,linux-all,macosx-all
javax/swing/JPopupMenu/6583251/bug6583251.java 8213564 linux-all
javax/swing/JPopupMenu/6675802/bug6675802.java 8196097 windows-all
javax/swing/JPopupMenu/6800513/bug6800513.java 7184956,8080868 macosx-all,windows-all
javax/swing/JPopupMenu/6800513/bug6800513.java 7184956,8080868 macosx-all,windows-all,linux-all
javax/swing/JPopupMenu/6987844/bug6987844.java 8169956 macosx-all,windows-all
javax/swing/JPopupMenu/7156657/bug7156657.java 8171381 macosx-all,windows-all
javax/swing/JPopupMenu/8075063/ContextMenuScrollTest.java 8202880 linux-all,windows-all,macosx-all
@@ -1061,7 +1062,7 @@ javax/swing/dnd/8139050/NativeErrorsInTableDnD.java
javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java 8198394 generic-all
javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java 8194945 macosx-all,linux-all,windows-all
javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java 8196434 linux-all,solaris-all
javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java 8198905,8137101 macosx-all,windows-all
javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java 8198905,8137101 macosx-all,windows-all,linux-all
javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java 8042383 macosx-all,windows-all
javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8196098 windows-all,linux-all
javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java 8172887 windows-all

View File

@@ -3,6 +3,7 @@ java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java
java/awt/Choice/GetSizeTest/GetSizeTest.java nobug macosx-all,windows-all
java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java nobug windows-all,linux-all
java/awt/Component/F10TopToplevel/F10TopToplevel.html nobug linux-all
java/awt/Component/PaintAll/PaintAll.java nobug linux-all
java/awt/Container/isRemoveNotifyNeeded/JInternalFrameTest.java nobug generic-all
java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java nobug macosx-all,windows-all
java/awt/Dialog/NestedDialogs/Modal/NestedModalDialogTest.java nobug macosx-all,windows-all
@@ -14,6 +15,8 @@ java/awt/EventDispatchThread/PreserveDispathThread/PreserveDispatchThread.java
java/awt/FileDialog/FileDialogMemoryLeak/FileDialogLeakTest.java nobug windows-all
java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.html nobug macosx-all
java/awt/FileDialog/MoveToTrashTest.java nobug windows-all
java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java nobug linux-all,windows-all
java/awt/Focus/6981400/Test2.java nobug linux-all
java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.html nobug linux-all,windows-all
java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java nobug linux-all,windows-all
java/awt/Focus/ConsumeNextKeyTypedOnModalShowTest/ConsumeNextKeyTypedOnModalShowTest.java nobug macosx-all,linux-all,windows-all
@@ -28,7 +31,9 @@ java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java
java/awt/Focus/RequestFocusAndHideTest/RequestFocusAndHideTest.java nobug macosx-all
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java nobug linux-all,windows-all reproduced with Adopt, OpenJDK
java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java nobug macosx-all,windows-all
java/awt/Frame/8158918/SetExtendedState.java nobug linux-all
java/awt/Frame/FrameLocation/FrameLocation.java nobug linux-all
java/awt/Frame/FrameSize/TestFrameSize.java nobug linux-all,mac-osx
java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java nobug linux-all,windows-all
java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java nobug macosx-all,windows-all
java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java nobug macosx-all,windows-all
@@ -43,7 +48,7 @@ java/awt/Graphics/LineClipTest.java
java/awt/Graphics2D/ScaledTransform/ScaledTransform.java nobug macosx-all,linux-all,windows-all
java/awt/JAWT/JAWT.sh nobug linux-all,windows-all
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.html nobug macosx-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogTest/EnqueueWithDialogTest.java nobug macosx-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogTest/EnqueueWithDialogTest.java nobug macosx-all,windows-all,linux-all
java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.html nobug windows-all reproduced with Adopt
java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java nobug windows-all
java/awt/List/ActionAfterRemove/ActionAfterRemove.java nobug windows-all
@@ -71,6 +76,7 @@ java/awt/Mouse/MouseWheelAbsXY/MouseWheelAbsXY.java
java/awt/MouseAdapter/MouseAdapterUnitTest/MouseAdapterUnitTest.java nobug macosx-all,windows-all
java/awt/MouseInfo/ComponentMousePositionTest.java nobug macosx-all,windows-all
java/awt/MouseInfo/JContainerMousePositionTest.java nobug macosx-all,windows-all
java/awt/Paint/ComponentIsNotDrawnAfterRemoveAddTest/ComponentIsNotDrawnAfterRemoveAddTest.java nobug linux-all,macosx-all,windows-all
java/awt/Paint/ExposeOnEDT.java nobug windows-all
java/awt/Paint/ListRepaint.java nobug linux-all (java.lang.NullPointerException reproduced with Adopt)
java/awt/PopupMenu/PopupMenuLocation.java nobug macosx-all,linux-all,windows-all
@@ -119,7 +125,6 @@ java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java
java/awt/event/KeyEvent/KeyChar/KeyCharTest.java nobug macosx-all,windows-all
java/awt/event/KeyEvent/KeyTyped/CtrlASCII.html nobug linux-all,windows-all
java/awt/event/KeyEvent/RobotCrash/RobotCrash.java nobug linux-all,windows-all
java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java nobug macosx-all,linux-all
java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java nobug macosx-all,windows-all,linux-all
java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java nobug macosx-all,windows-all
java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java nobug macosx-all,linux-all,windows-all
@@ -149,7 +154,7 @@ java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java
javax/swing/JComboBox/4199622/bug4199622.java nobug windows-all
javax/swing/JComboBox/4523758/bug4523758.java nobug macosx-all,windows-all
javax/swing/JDialog/Transparency/TransparencyTest.java nobug macosx-all,windows-all
javax/swing/JDialog/Transparency/TransparencyTest.java nobug linux-all,macosx-all,windows-all
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest.java nobug windows-all
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest_i18n.java nobug windows-all
javax/swing/JFileChooser/6489130/bug6489130.java nobug macosx-all
@@ -163,7 +168,7 @@ javax/swing/JInternalFrame/8020708/bug8020708.java
javax/swing/JInternalFrame/8145060/TestJInternalFrameMinimize.java nobug macosx-all,linux-all,windows-all
javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java nobug macosx-all
javax/swing/JInternalFrame/Test6802868.java nobug macosx-all,linux-all
javax/swing/JLabel/7004134/bug7004134.java nobug macosx-all
javax/swing/JLabel/7004134/bug7004134.java nobug macosx-all,linux-all
javax/swing/JList/6510999/bug6510999.java nobug linux-all,macosx-all,windows-all
javax/swing/JList/BasicListTest.java nobug macosx-all
javax/swing/JMenu/6538132/bug6538132.java nobug windows-all

View File

@@ -0,0 +1,710 @@
/*
* Copyright 2019 JetBrains s.r.o.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package performance.rendering;
import org.junit.Test;
import util.Renderer;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.QuadCurve2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class RenderPerfTest {
private final static int N = 1000;
private final static float R = 25;
private final static int COUNT = 300;
static class Particles {
private float[] bx;
private float[] by;
private float[] vx;
private float[] vy;
private float r;
private int n;
private float x0;
private float y0;
private float width;
private float height;
Particles(int n, float r, float x0, float y0, float width, float height) {
bx = new float[n];
by = new float[n];
vx = new float[n];
vy = new float[n];
this.n = n;
this.r = r;
this.x0 = x0;
this.y0 = y0;
this.width = width;
this.height = height;
for (int i = 0; i < n; i++) {
bx[i] = (float) (x0 + r + 0.1 + Math.random() * (width - 2 * r - 0.2 - x0));
by[i] = (float) (y0 + r + 0.1 + Math.random() * (height - 2 * r - 0.2 - y0));
vx[i] = 0.1f * (float) (Math.random() * 2 * r - r);
vy[i] = 0.1f * (float) (Math.random() * 2 * r - r);
}
}
void render(Graphics2D g2d, ParticleRenderer renderer) {
for (int i = 0; i < n; i++) {
renderer.render(g2d, i, bx, by, vx, vy);
}
}
void update() {
for (int i = 0; i < n; i++) {
bx[i] += vx[i];
if (bx[i] + r > width || bx[i] - r < x0) vx[i] = -vx[i];
by[i] += vy[i];
if (by[i] + r > height || by[i] - r < y0) vy[i] = -vy[i];
}
}
}
interface ParticleRenderer {
void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy);
}
private static void report(String name, double value) {
System.err.println("##teamcity[buildStatisticValue key='" + name + "' value='" + value +"']");
}
static class FlatParticleRenderer implements ParticleRenderer {
Color[] colors;
float r;
FlatParticleRenderer(int n, float r) {
colors = new Color[n];
this.r = r;
for (int i = 0; i < n; i++) {
colors[i] = new Color((float) Math.random(),
(float) Math.random(), (float) Math.random());
}
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.fillOval((int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r));
}
}
static class WhiteTextParticleRenderer implements ParticleRenderer {
float r;
Object hint;
WhiteTextParticleRenderer(float r, Object hint) {
this.r = r;
this.hint = hint;
}
void setPaint(Graphics2D g2d, int id) {
g2d.setColor(Color.WHITE);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, hint);
setPaint(g2d, id);
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)(y[id] - r));
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)y[id]);
g2d.drawString("The quick brown fox jumps over the lazy dog",
(int)(x[id] - r), (int)(y[id] + r));
}
}
static class TextParticleRenderer extends WhiteTextParticleRenderer {
Color[] colors;
float r;
TextParticleRenderer(int n, float r, Object hint) {
super(r, hint);
colors = new Color[n];
this.r = r;
for (int i = 0; i < n; i++) {
colors[i] = new Color((float) Math.random(),
(float) Math.random(), (float) Math.random());
}
}
void setPaint(Graphics2D g2d, int id) {
g2d.setColor(colors[id % colors.length]);
}
}
static class FlatOvalRotParticleRenderer extends FlatParticleRenderer {
FlatOvalRotParticleRenderer(int n, float r) {
super(n, r);
}
void setPaint(Graphics2D g2d, int id) {
g2d.setColor(colors[id % colors.length]);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
setPaint(g2d, id);
if (Math.abs(vx[id] + vy[id]) > 0.001) {
AffineTransform t = (AffineTransform) g2d.getTransform().clone();
double l = vx[id] / Math.sqrt(vx[id] * vx[id] + vy[id] * vy[id]);
if (vy[id] < 0) {
l = -l;
}
g2d.translate(x[id], y[id]);
g2d.rotate(Math.acos(l));
g2d.fillOval(-(int)r, (int)(-0.5*r), (int) (2 * r), (int)r);
g2d.setTransform(t);
} else {
g2d.fillOval((int)(x[id] - r), (int)(y[id] - 0.5*r),
(int) (2 * r), (int) r);
}
}
}
static class LinGradOvalRotParticleRenderer extends FlatOvalRotParticleRenderer {
LinGradOvalRotParticleRenderer(int n, float r) {
super(n, r);
}
@Override
void setPaint(Graphics2D g2d, int id) {
Point2D start = new Point2D.Double(- r, - 0.5*r);
Point2D end = new Point2D.Double( 2 * r, r);
float[] dist = {0.0f, 1.0f};
Color[] cls = {colors[id %colors.length], colors[(colors.length - id) %colors.length]};
LinearGradientPaint p =
new LinearGradientPaint(start, end, dist, cls);
g2d.setPaint(p);
}
}
static class FlatBoxParticleRenderer extends FlatParticleRenderer {
FlatBoxParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.fillRect((int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r));
}
}
static class ImgParticleRenderer extends FlatParticleRenderer {
BufferedImage dukeImg;
ImgParticleRenderer(int n, float r) {
super(n, r);
String testDataStr = System.getProperty("testdata");
assertNotNull("testdata property is not set", testDataStr);
File testData = new File(testDataStr, "performance" + File.separator + "rendering");
assertTrue("Test data dir does not exist", testData.exists());
File dukeFile = new File(testData, "duke.png");
if (!dukeFile.exists()) throw new RuntimeException(dukeFile.toString() + " not found");
try {
dukeImg = ImageIO.read(dukeFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.drawImage(dukeImg, (int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r), null);
}
}
static class FlatBoxRotParticleRenderer extends FlatParticleRenderer {
FlatBoxRotParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
if (Math.abs(vx[id] + vy[id]) > 0.001) {
AffineTransform t = (AffineTransform) g2d.getTransform().clone();
double l = vx[id] / Math.sqrt(vx[id] * vx[id] + vy[id] * vy[id]);
if (vy[id] < 0) {
l = -l;
}
g2d.translate(x[id], y[id]);
g2d.rotate(Math.acos(l));
g2d.fillRect(-(int)r, -(int)r, (int) (2 * r), (int) (2 * r));
g2d.setTransform(t);
} else {
g2d.fillRect((int)(x[id] - r), (int)(y[id] - r),
(int) (2 * r), (int) (2 * r));
}
}
}
static class WiredParticleRenderer extends FlatParticleRenderer {
WiredParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.drawOval((int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r));
}
}
static class WiredBoxParticleRenderer extends FlatParticleRenderer {
WiredBoxParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
g2d.setColor(colors[id % colors.length]);
g2d.drawRect((int)(x[id] - r), (int)(y[id] - r), (int)(2*r), (int)(2*r));
}
}
static class SegParticleRenderer extends FlatParticleRenderer {
SegParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
double v = Math.sqrt(vx[id]*vx[id]+vy[id]*vy[id]);
float nvx = (float) (vx[id]/v);
float nvy = (float) (vy[id]/v);
g2d.setColor(colors[id % colors.length]);
g2d.drawLine((int)(x[id] - r*nvx), (int)(y[id] - r*nvy),
(int)(x[id] + 2*r*nvx), (int)(y[id] + 2*r*nvy));
}
}
static class WiredQuadParticleRenderer extends FlatParticleRenderer {
WiredQuadParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
if (id > 2 && (id % 3) == 0) {
g2d.setColor(colors[id % colors.length]);
g2d.draw(new QuadCurve2D.Float(x[id-3], y[id-3], x[id-2], y[id-2], x[id-1], y[id-1]));
}
}
}
static class FlatQuadParticleRenderer extends FlatParticleRenderer {
FlatQuadParticleRenderer(int n, float r) {
super(n, r);
}
@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
if (id > 2 && (id % 3) == 0) {
g2d.setColor(colors[id % colors.length]);
g2d.fill(new QuadCurve2D.Float(x[id-3], y[id-3], x[id-2], y[id-2], x[id-1], y[id-1]));
}
}
}
private static final Particles balls = new Particles(N, R, 0, 0, Renderer.WIDTH, Renderer.HEIGHT);
private static final ParticleRenderer flatRenderer = new FlatParticleRenderer(N, R);
private static final ParticleRenderer flatOvalRotRenderer = new FlatOvalRotParticleRenderer(N, R);
private static final ParticleRenderer flatBoxRenderer = new FlatBoxParticleRenderer(N, R);
private static final ParticleRenderer flatBoxRotRenderer = new FlatBoxRotParticleRenderer(N, R);
private static final ParticleRenderer linGradOvalRotRenderer = new LinGradOvalRotParticleRenderer(N, R);
private static final ParticleRenderer wiredRenderer = new WiredParticleRenderer(N, R);
private static final ParticleRenderer wiredBoxRenderer = new WiredBoxParticleRenderer(N, R);
private static final ParticleRenderer segRenderer = new SegParticleRenderer(N, R);
private static final ParticleRenderer flatQuadRenderer = new FlatQuadParticleRenderer(N, R);
private static final ParticleRenderer wiredQuadRenderer = new WiredQuadParticleRenderer(N, R);
private static final ParticleRenderer imgRenderer = new ImgParticleRenderer(N, R);
private static final ParticleRenderer textRendererNoAA =
new TextParticleRenderer(N, R, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
private static final ParticleRenderer textRendererLCD =
new TextParticleRenderer(N, R, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
private static final ParticleRenderer textRendererGray =
new TextParticleRenderer(N, R, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
private static final ParticleRenderer whiteTextRendererNoAA =
new WhiteTextParticleRenderer(R, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
private static final ParticleRenderer whiteTextRendererLCD =
new WhiteTextParticleRenderer(R, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
private static final ParticleRenderer whiteTextRendererGray =
new WhiteTextParticleRenderer(R, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
@Test
public void testFlatBubbles() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.Renderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatRenderer);
}
@Override
public void update() {
balls.update();
}
@Override
public void screenShot(BufferedImage result) {
System.err.println();
}
});
report("FlatOval", fps);
}
@Test
public void testFlatBoxBubbles() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatBoxRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("FlatBox", fps);
}
@Test
public void testImgBubbles() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, imgRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("Image", fps);
}
@Test
public void testFlatBoxRotBubbles() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatBoxRotRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("RotatedBox", fps);
}
@Test
public void testFlatOvalRotBubbles() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatOvalRotRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("RotatedOval", fps);
}
@Test
public void testLinGradOvalRotBubbles() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, linGradOvalRotRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("LinGradRotatedOval", fps);
}
@Test
public void testWiredBubbles() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, wiredRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("WiredOval", fps);
}
@Test
public void testWiredBoxBubbles() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, wiredBoxRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("WiredBox", fps);
}
@Test
public void testLines() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, segRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("Lines", fps);
}
@Test
public void testFlatQuad() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, flatQuadRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("FlatQuad", fps);
}
@Test
public void testWiredQuad() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, wiredQuadRenderer);
}
@Override
public void update() {
balls.update();
}
});
report("WiredQuad", fps);
}
@Test
public void testTextBubblesNoAA() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, textRendererNoAA);
}
@Override
public void update() {
balls.update();
}
});
report("TextNoAA", fps);
}
@Test
public void testTextBubblesLCD() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, textRendererLCD);
}
@Override
public void update() {
balls.update();
}
});
report("TextLCD", fps);
}
@Test
public void testTextBubblesGray() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, textRendererGray);
}
@Override
public void update() {
balls.update();
}
});
report("TextGray", fps);
}
@Test
public void testWhiteTextBubblesNoAA() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, whiteTextRendererNoAA);
}
@Override
public void update() {
balls.update();
}
});
report("WhiteTextNoAA", fps);
}
@Test
public void testWhiteTextBubblesLCD() throws Exception {
double fps = (new util.Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, whiteTextRendererLCD);
}
@Override
public void update() {
balls.update();
}
});
report("WhiteTextLCD", fps);
}
@Test
public void testWhiteTextBubblesGray() throws Exception {
double fps = (new Renderer(COUNT)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
balls.render(g2d, whiteTextRendererGray);
}
@Override
public void update() {
balls.update();
}
});
report("WhiteTextGray", fps);
}
}

View File

@@ -1,14 +1,12 @@
package quality.text;
import org.junit.Test;
import quality.util.RenderUtil;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.io.File;
@@ -40,7 +38,7 @@ public class DroidFontTest {
String[] testDataVariant = {
"osx_hardware_rendering", "osx_software_rendering", "osx_sierra_rendering",
"linux_rendering"};
"osx_mojave_rendering", "linux_rendering"};
String testDataStr = System.getProperty("testdata");
assertNotNull("testdata property is not set", testDataStr);
@@ -70,7 +68,7 @@ public class DroidFontTest {
(int) bnd.getWidth(), (int) bnd.getHeight());
String gfName = name.toLowerCase().replace(" ", "") +
Integer.toString(style) + "_" + Integer.toString(size) + ".png";
style + "_" + size + ".png";
if (System.getProperty("gentestdata") == null) {
boolean failed = true;
@@ -98,7 +96,7 @@ public class DroidFontTest {
for (int j = 0; j < gRaster.getHeight(); j++) {
gRaster.getPixel(i, j, gArr);
rRaster.getPixel(i, j, rArr);
assertTrue(gArr.length == rArr.length);
assertEquals(gArr.length, rArr.length);
for (int k = 0; k < gArr.length; k++) {
if (gArr[k] != rArr[k]) {
failureReason.append(variant).append(" : Different pixels found ").append("at (").append(i).append(",").append(j).append(")");

View File

@@ -0,0 +1,37 @@
package quality.text;
import org.junit.Assert;
import org.junit.Test;
import quality.util.RenderUtil;
import util.Renderer;
import java.awt.*;
import java.awt.image.BufferedImage;
public class FiraCodeScrTest {
@Test
public void testRenderText() throws Exception {
String [] testResult = new String[] {null};
(new util.Renderer(2, 300, 30, true)).exec(new Renderer.DefaultRenderable() {
@Override
public void render(Graphics2D g2d) {
g2d.setColor(Color.WHITE);
Font f = new Font("Fira Code", Font.PLAIN, 12);
g2d.setFont(f);
g2d.drawString("The quick brown fox jumps over the lazy dog", 0, 15);
}
@Override
public void screenShot(BufferedImage result) {
try {
RenderUtil.checkImage(result, "text", "firacode.png");
} catch (Exception e) {
testResult[0] = e.getMessage();
}
}
});
if (testResult[0] != null) Assert.fail(testResult[0]);
}
}

Some files were not shown because too many files have changed in this diff Show More