[libbluray-devel] Factorize common init code
hpi1
git at videolan.org
Fri Nov 21 11:01:41 CET 2014
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Nov 20 10:34:42 2014 +0200| [98973cd0f909e4780d2db33480414f28cbf1e63b] | committer: hpi1
Factorize common init code
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=98973cd0f909e4780d2db33480414f28cbf1e63b
---
.../bdj/java/java/awt/BDGraphicsBase.java | 25 ++++++++------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java b/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
index e6a1dc7..1bf74c3 100644
--- a/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
+++ b/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
@@ -100,21 +100,8 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
foreground = window.getForeground();
background = window.getBackground();
font = window.getFont();
- if (foreground == null)
- foreground = DEFAULT_COLOR;
- if (background == null)
- background = DEFAULT_COLOR;
- if (font == null) {
- font = GUIManager.getInstance().getDefaultFont();
- if (font == null) {
- font = DEFAULT_FONT;
- }
- }
- fontMetrics = null;
-
- composite = AlphaComposite.SrcOver;
- setupClip();
+ postInit();
}
BDGraphicsBase(BDImage image) {
@@ -130,11 +117,19 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
background = component.getBackground();
font = component.getFont();
}
+ if (background == null)
+ background = new Color(0, 0, 0, 0);
+
+ postInit();
+ }
+
+ private void postInit() {
if (foreground == null)
foreground = DEFAULT_COLOR;
if (background == null)
- background = new Color(0, 0, 0, 0);
+ background = DEFAULT_COLOR;
+ /* if font is not set, use AWT default font from BDJO */
if (font == null) {
font = GUIManager.getInstance().getDefaultFont();
if (font == null) {
More information about the libbluray-devel
mailing list