Skip to content

Commit 11760ca

Browse files
committed
[GR-15037] Avoid using GraphicsEnvironment in when using remote grid device.
PullRequest: fastr/1997
2 parents 6397252 + 09a050e commit 11760ca

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/Graphics2DDevice.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,7 @@
4444
import com.oracle.truffle.r.library.fastrGrid.device.DrawingContext.GridLineJoin;
4545
import com.oracle.truffle.r.library.fastrGrid.device.GridColor;
4646
import com.oracle.truffle.r.library.fastrGrid.device.GridDevice;
47+
import com.oracle.truffle.r.runtime.FastRConfig;
4748
import com.oracle.truffle.r.runtime.RInternalError;
4849

4950
/**
@@ -59,7 +60,7 @@ public class Graphics2DDevice implements GridDevice {
5960
// may wish to apply his/her own transformations to the graphics object and we should not
6061
// interfere with these. In cases we do use transformation, we make sure to set back the
6162
// original one after we're done.
62-
static final double AWT_POINTS_IN_INCH = GraphicsEnvironment.isHeadless() ? 72. : Toolkit.getDefaultToolkit().getScreenResolution();
63+
static final double AWT_POINTS_IN_INCH = FastRConfig.UseRemoteGridAwtDevice || GraphicsEnvironment.isHeadless() ? 72. : Toolkit.getDefaultToolkit().getScreenResolution();
6364

6465
private static final BasicStroke blankStroke = new BasicStroke(0f);
6566

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/InitWindowedDevice.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ protected Object call(RArgsValuesAndNames args) {
7575
// check if we got custom Graphics2D object as 3rd parameter
7676
boolean isFastRDevice = args.getArgument(0).equals(".FASTR.AWT");
7777
if (isFastRDevice && args.getLength() > 3) {
78+
if (FastRConfig.UseRemoteGridAwtDevice) {
79+
throw error(Message.GENERIC, "Using custom Graphics2D object is not supported on the remote grid device.");
80+
}
7881
Object arg3 = args.getArgument(3);
7982
boolean isForeignTruffleObj = RRuntime.isForeignObject(arg3);
8083
TruffleLanguage.Env env = RContext.getInstance().getEnv();

0 commit comments

Comments
 (0)