Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8241490: Add large text performance tests in RenderPerfTest
  • Loading branch information
jayathirthrao committed Mar 24, 2020
1 parent db88ce1 commit e5d516d18203c5386cff776d9e47888c4e6c465f
Showing with 33 additions and 1 deletion.
  1. +33 −1 src/demo/share/java2d/RenderPerfTest/src/renderperf/RenderPerfTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020 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
@@ -237,6 +237,26 @@ void setPaint(Graphics2D g2d, int id) {
}
}

static class LargeTextParticleRenderer extends TextParticleRenderer {

LargeTextParticleRenderer(int n, float r) {
super(n, r);
}

@Override
public void render(Graphics2D g2d, int id, float[] x, float[] y, float[] vx, float[] vy) {
setPaint(g2d, id);
Font font = new Font("LucidaGrande", Font.PLAIN, 32);
g2d.setFont(font);
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 FlatOvalRotParticleRenderer extends FlatParticleRenderer {


@@ -568,6 +588,7 @@ private boolean isAlmostEqual(Color c1, Color c2) {
private static final ParticleRenderer wiredQuadRenderer = new WiredQuadParticleRenderer(N, R);
private static final ParticleRenderer imgRenderer = new ImgParticleRenderer(N, R);
private static final ParticleRenderer textRenderer = new TextParticleRenderer(N, R);
private static final ParticleRenderer largeTextRenderer = new LargeTextParticleRenderer(N, R);
private static final ParticleRenderer whiteTextRenderer = new WhiteTextParticleRenderer(R);

private static final Configurable AA = (Graphics2D g2d) ->
@@ -682,6 +703,17 @@ public void testTextBubblesGray() throws Exception {
(new PerfMeter("TextGray")).exec(createPR(textRenderer).configure(TextAA)).report();
}

public void testLargeTextBubblesNoAA() throws Exception {
(new PerfMeter("LargeTextNoAA")).exec(createPR(largeTextRenderer)).report();
}

public void testLargeTextBubblesLCD() throws Exception {
(new PerfMeter("LargeTextLCD")).exec(createPR(largeTextRenderer).configure(TextLCD)).report();
}

public void testLargeTextBubblesGray() throws Exception {
(new PerfMeter("LargeTextGray")).exec(createPR(largeTextRenderer).configure(TextAA)).report();
}
public void testWhiteTextBubblesNoAA() throws Exception {
(new PerfMeter("WhiteTextNoAA")).exec(createPR(whiteTextRenderer)).report();
}

0 comments on commit e5d516d

Please sign in to comment.