mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8374340: FontRenderContext instance variables should be final
Reviewed-by: aivanov, aturbanov, prr, serb
This commit is contained in:
parent
136ac0d10b
commit
3f65215960
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -62,19 +62,18 @@ import java.awt.geom.AffineTransform;
|
||||
* @see java.awt.Graphics2D#getFontRenderContext()
|
||||
* @see java.awt.font.LineMetrics
|
||||
*/
|
||||
|
||||
public class FontRenderContext {
|
||||
private transient AffineTransform tx;
|
||||
private transient Object aaHintValue;
|
||||
private transient Object fmHintValue;
|
||||
private transient boolean defaulting;
|
||||
private final transient AffineTransform tx;
|
||||
private final transient Object aaHintValue;
|
||||
private final transient Object fmHintValue;
|
||||
private final transient boolean defaulting;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FontRenderContext}
|
||||
* object.
|
||||
*
|
||||
*/
|
||||
protected FontRenderContext() {
|
||||
tx = null;
|
||||
aaHintValue = VALUE_TEXT_ANTIALIAS_DEFAULT;
|
||||
fmHintValue = VALUE_FRACTIONALMETRICS_DEFAULT;
|
||||
defaulting = true;
|
||||
@ -105,6 +104,8 @@ public class FontRenderContext {
|
||||
boolean usesFractionalMetrics) {
|
||||
if (tx != null && !tx.isIdentity()) {
|
||||
this.tx = new AffineTransform(tx);
|
||||
} else {
|
||||
this.tx = null;
|
||||
}
|
||||
if (isAntiAliased) {
|
||||
aaHintValue = VALUE_TEXT_ANTIALIAS_ON;
|
||||
@ -116,6 +117,7 @@ public class FontRenderContext {
|
||||
} else {
|
||||
fmHintValue = VALUE_FRACTIONALMETRICS_OFF;
|
||||
}
|
||||
defaulting = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,6 +147,8 @@ public class FontRenderContext {
|
||||
public FontRenderContext(AffineTransform tx, Object aaHint, Object fmHint){
|
||||
if (tx != null && !tx.isIdentity()) {
|
||||
this.tx = new AffineTransform(tx);
|
||||
} else {
|
||||
this.tx = null;
|
||||
}
|
||||
try {
|
||||
if (KEY_TEXT_ANTIALIASING.isCompatibleValue(aaHint)) {
|
||||
@ -164,6 +168,7 @@ public class FontRenderContext {
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("FM hint:" +fmHint);
|
||||
}
|
||||
defaulting = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user