From fd1b9f9fb001f0d7d2ab0e4c73a45f09ee864233 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 5 Sep 2015 08:38:40 -0400 Subject: [PATCH] a little housekeeping --- core/.settings/org.eclipse.jdt.core.prefs | 7 ++-- core/src/processing/awt/PGraphicsJava2D.java | 4 +- core/src/processing/core/PGraphics.java | 6 +-- core/src/processing/javafx/PGraphicsFX2D.java | 37 +++++++++---------- .../processing/opengl/PGraphicsOpenGL.java | 4 +- core/todo.txt | 21 ++++++++--- todo.txt | 4 ++ 7 files changed, 49 insertions(+), 34 deletions(-) diff --git a/core/.settings/org.eclipse.jdt.core.prefs b/core/.settings/org.eclipse.jdt.core.prefs index 8e54f4641..80ae959bd 100644 --- a/core/.settings/org.eclipse.jdt.core.prefs +++ b/core/.settings/org.eclipse.jdt.core.prefs @@ -6,9 +6,10 @@ org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annota org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -96,7 +97,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/core/src/processing/awt/PGraphicsJava2D.java b/core/src/processing/awt/PGraphicsJava2D.java index a35936b8a..511a808e1 100644 --- a/core/src/processing/awt/PGraphicsJava2D.java +++ b/core/src/processing/awt/PGraphicsJava2D.java @@ -1893,7 +1893,7 @@ public class PGraphicsJava2D extends PGraphics { * will get recorded properly. */ @Override - protected void setTextSize(float size) { + protected void handleTextSize(float size) { // if a native version available, derive this font // if (textFontNative != null) { // textFontNative = textFontNative.deriveFont(size); @@ -1927,7 +1927,7 @@ public class PGraphicsJava2D extends PGraphics { // take care of setting the textSize and textLeading vars // this has to happen second, because it calls textAscent() // (which requires the native font metrics to be set) - super.setTextSize(size); + super.handleTextSize(size); } diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 75c2ac081..23951f393 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -4237,7 +4237,7 @@ public class PGraphics extends PImage implements PConstants { } */ - setTextSize(size); + handleTextSize(size); } @@ -4361,7 +4361,7 @@ public class PGraphics extends PImage implements PConstants { * @param size size of the text, greater than zero */ protected void textSizeImpl(float size) { - setTextSize(size); + handleTextSize(size); } @@ -4370,7 +4370,7 @@ public class PGraphics extends PImage implements PConstants { * from textFontImpl after setting the font. * @param size size of the text, greater than zero */ - protected void setTextSize(float size) { + protected void handleTextSize(float size) { textSize = size; textLeading = (textAscent() + textDescent()) * 1.275f; } diff --git a/core/src/processing/javafx/PGraphicsFX2D.java b/core/src/processing/javafx/PGraphicsFX2D.java index ab68ef651..c920575c7 100644 --- a/core/src/processing/javafx/PGraphicsFX2D.java +++ b/core/src/processing/javafx/PGraphicsFX2D.java @@ -1333,7 +1333,6 @@ public class PGraphicsFX2D extends PGraphics { static final class FontInfo { - // TODO: this should be based on memory consumption // this should be enough e.g. for all grays and alpha combos static final int MAX_CACHED_COLORS_PER_FONT = 1 << 16; @@ -1348,7 +1347,6 @@ public class PGraphicsFX2D extends PGraphics { static final class FontCache { - static final int MAX_CACHE_SIZE = 512; // keeps track of filenames of fonts loaded from ttf and otf files @@ -1427,14 +1425,14 @@ public class PGraphicsFX2D extends PGraphics { } } -// -// ////////////////////////////////////////////////////////////// -// -// // TEXT -// -// // None of the variations of text() are overridden from PGraphics. -// -// + + /////////////////////////////////////////////////////////////// + + // TEXT + + // None of the variations of text() are overridden from PGraphics. + + ////////////////////////////////////////////////////////////// @@ -1443,24 +1441,25 @@ public class PGraphicsFX2D extends PGraphics { @Override protected void textFontImpl(PFont which, float size) { - setTextFont(which, size); - setTextSize(size); + handleTextFont(which, size); + handleTextSize(size); } @Override protected void textSizeImpl(float size) { - setTextFont(textFont, size); - setTextSize(size); + handleTextFont(textFont, size); + handleTextSize(size); } + /** * FX specific. When setting font or size, new font has to * be created. Both textFontImpl and textSizeImpl call this one. * @param which font to be set, not null * @param size size to be set, greater than zero */ - protected void setTextFont(PFont which, float size) { + protected void handleTextFont(PFont which, float size) { textFont = which; String fontName = which.getName(); @@ -1562,16 +1561,16 @@ public class PGraphicsFX2D extends PGraphics { float x2 = x1 + bwidth * textSize; float y2 = y1 + high * textSize; - PImage glyphImage = fillColor == 0xFFFFFFFF ? - glyph.image : - getTintedGlyphImage(glyph, fillColor); + PImage glyphImage = (fillColor == 0xFFFFFFFF) ? + glyph.image : getTintedGlyphImage(glyph, fillColor); textCharModelImpl(glyphImage, x1, y1, x2, y2, glyph.width, glyph.height); } } else if (ch != ' ' && ch != 127) { - showWarning("No glyph found for the " + ch + " (\\u" + PApplet.hex(ch, 4) + ") character"); + showWarning("No glyph found for the " + ch + + " (\\u" + PApplet.hex(ch, 4) + ") character"); } } diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 2b41df60b..2d8c47fd7 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -4208,13 +4208,13 @@ public class PGraphicsOpenGL extends PGraphics { @Override - protected void setTextSize(float size) { + protected void handleTextSize(float size) { Font font = (Font) textFont.getNative(); if (font != null) { Object dfont = pgl.getDerivedFont(font, size); textFont.setNative(dfont); } - super.setTextSize(size); + super.handleTextSize(size); } diff --git a/core/todo.txt b/core/todo.txt index f830b2ddc..cec6b8e49 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -2,15 +2,25 @@ X Incomplete text rendering of strings with consecutive line breaks X https://github.com/processing/processing/issues/3736 X https://github.com/processing/processing/pull/3737 +X https://github.com/processing/processing/issues/3761 X add the Contents/Java folder to java.library.path on OS X X allows exported applications to use the Sound library +_ textFont() and textSize() are each calling one another +_ move createFont() to PGraphics _ SVG only exports last frame +_ possibly because Java2D is disposing the Graphics2D in between? _ https://github.com/processing/processing/issues/3753 andres X P2D: error calling surface.setTitle() X https://github.com/processing/processing/issues/3721 X https://github.com/processing/processing/commit/a384cbf0890a49dbf6e0fdd80e048de80e5d78d2 +X Error message with noLoop() and P2D renderer +X https://github.com/processing/processing/issues/3558 +X Concurrency issues in OpenGL renderer prevent proper garbage collection +X https://github.com/processing/processing/issues/3384 +X In P2D/P3D the background is cleared to black on each frame +_ https://github.com/processing/processing/issues/3559 jakub X FX - fix transformation stack NPE @@ -49,14 +59,15 @@ X Render text starting with space properly X https://github.com/processing/processing/pull/3746 X FX - smooth for the main surface X https://github.com/processing/processing/pull/3749 - - -known issues -_ P2D and P3D windows behave strangely when larger than the screen size -_ https://github.com/processing/processing/issues/3401 +X OpenGL - clean up loaded and modified for pixels +X https://github.com/processing/processing/pull/3768 +X FX - text stuff, move createFont() into PGraphics +X https://github.com/processing/processing/pull/3766 3.0 final +_ P2D and P3D windows behave strangely when larger than the screen size +_ https://github.com/processing/processing/issues/3401 _ move blending calculations from PImage into PGraphics _ tricky because that means moving blend_resize() as well _ and should that live in PGraphics or be its own class or ?? diff --git a/todo.txt b/todo.txt index 30b6ff8fc..045f7635f 100644 --- a/todo.txt +++ b/todo.txt @@ -60,6 +60,7 @@ _ mouse events (i.e. toggle breakpoint) seem to be firing twice 3.0 final +_ https://github.com/processing/processing/milestones/3.0%20final _ change Tool API because it's not one Editor per Tool anymore? _ or just change the documentation? _ Contributions Manager UI design @@ -94,7 +95,10 @@ _ add this to the preferences? gui +_ don't allow breakpoints to be set on blank lines +_ https://github.com/processing/processing/issues/3765 _ different design of squiggly line? +_ build custom scroll bar since the OS versions are so ugly? _ Error/warning location visualisation not updating when editor resizes _ https://github.com/processing/processing/issues/3619 _ error/warning location is awkward when no scroll bar is in use