Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/scripts/generate-quality-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ def main() -> None:
"ES_COMPARING_PARAMETER_STRING_WITH_EQ",
"FE_FLOATING_POINT_EQUALITY",
"FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER",
"ICAST_IDIV_CAST_TO_DOUBLE",
"SA_FIELD_SELF_ASSIGNMENT",
"UC_USELESS_CONDITION",
"UC_USELESS_OBJECT",
Expand Down
16 changes: 8 additions & 8 deletions CodenameOne/src/com/codename1/charts/ChartComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public void pointerDragged(int[] x, int[] y) {
double[] panLimits = xyChart.getRenderer().getPanLimits();

if (zoomStart == null) {
zoomStart = new Point((x[0] + x[1]) / 2, (y[0] + y[1]) / 2);
zoomStart = new Point((x[0] + x[1]) / 2f, (y[0] + y[1]) / 2f);

zoomDistStartX = Math.abs(x[0] - x[1]);
zoomDistStartY = Math.abs(y[0] - y[1]);
Expand All @@ -503,8 +503,8 @@ public void pointerDragged(int[] x, int[] y) {
if (dx == 0) dx = 1;
if (dy == 0) dy = 1;

double zoomX = zoomDistStartX / dx;
double zoomY = zoomDistStartY / dy;
double zoomX = (double) zoomDistStartX / dx;
double zoomY = (double) zoomDistStartY / dy;


BBox newBounds = zoomStartBBox.scaleScreenCoords((float) zoomX, (float) zoomY);
Expand Down Expand Up @@ -571,19 +571,19 @@ public void pointerDragged(int[] x, int[] y) {
}
} else {
if (zoomStart == null) {
zoomStart = new Point((x[0] + x[1]) / 2, (y[0] + y[1]) / 2);
zoomStart = new Point((x[0] + x[1]) / 2f, (y[0] + y[1]) / 2f);
zoomTransformStart = Transform.makeIdentity();
if (transform != null) {
zoomTransformStart.concatenate(transform);
}
int dx = Math.abs(x[0] - x[1]) / 2;
int dy = Math.abs(y[0] - y[1]) / 2;
double dx = Math.abs(x[0] - x[1]) / 2f;
double dy = Math.abs(y[0] - y[1]) / 2f;
zoomDistStart = Math.sqrt(dx * dx + dy * dy);


} else {
int dx = Math.abs(x[0] - x[1]) / 2;
int dy = Math.abs(y[0] - y[1]) / 2;
double dx = Math.abs(x[0] - x[1]) / 2f;
double dy = Math.abs(y[0] - y[1]) / 2f;
double zoomDist = Math.sqrt(dx * dx + dy * dy);
if (zoomDist == 0) {
zoomDist = 1;
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/charts/views/RadarChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void draw(Canvas canvas, int x, int y, int width, int height, Paint paint
float angle = 360f / cLength;

// Draw web
float centerX = (left + right) / 2, centerY = (top + bottom) / 2;
float centerX = (left + right) / 2f, centerY = (top + bottom) / 2f;
for (int i = 0; i < cLength; i++) {
paint.setColor(ColorUtil.GRAY);
float thisRad = (float) Math.toRadians(90 - currentAngle);
Expand Down
4 changes: 2 additions & 2 deletions CodenameOne/src/com/codename1/charts/views/XYChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ public void draw(Canvas canvas, int x, int y, int width, int height, Paint paint
int angle = or.getAngle();
boolean rotate = angle == 90;
mScale = (float) (height) / width;
mTranslate = Math.abs(width - height) / 2;
mTranslate = Math.abs(width - height) / 2f;
if (mScale < 1) {
mTranslate *= -1;
}
mCenter = new Point((x + width) / 2, (y + height) / 2);
mCenter = new Point((x + width) / 2f, (y + height) / 2f);
if (rotate) {
transform(canvas, angle, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2871,8 +2871,8 @@ public void fillRectRadialGradient(Object graphics, int startColor, int endColor
int centerX = (int) (width * (1 - relativeX));
int centerY = (int) (height * (1 - relativeY));
int size = (int) (Math.min(width, height) * relativeSize);
int x2 = (int) (width / 2 - (size * relativeX));
int y2 = (int) (height / 2 - (size * relativeY));
int x2 = (int) (width * 0.5f - (size * relativeX));
int y2 = (int) (height * 0.5f - (size * relativeY));
boolean aa = isAntiAliased(graphics);
setAntiAliased(graphics, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected void deinitialize() {
* @since 7.0
*/
public static class CircleProgress extends ProgressAnimation {
int stepSize = (int) Math.round(360 / Display.getInstance().getFrameRate() / 1.5);
int stepSize = (int) Math.round(360.0 / Display.getInstance().getFrameRate() / 1.5);
int step = 0;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ public void paint(Graphics g) {


currTransform.scale(xfactor, yfactor, 0f);
currTransform.translate((x + w / 2) / xfactor, (y + h / 2) / yfactor, 0);
currTransform.translate((x + w * 0.5f) / xfactor, (y + h * 0.5f) / yfactor, 0);

currTransform.concatenate(perspectiveT);

float cameraZ = -zNear - w / 2 * zState;
float cameraX = -x - w / 2;
float cameraY = -y - h / 2;
float cameraZ = -zNear - w * 0.5f * zState;
float cameraX = -x - w * 0.5f;
float cameraY = -y - h * 0.5f;
currTransform.translate(cameraX, cameraY, cameraZ);

if (transitionState == STATE_FLIP) {
Expand Down
4 changes: 2 additions & 2 deletions CodenameOne/src/com/codename1/ui/geom/Geometry.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public int n() {
* @return The coefficient
*/
public double cx(int j) {
return factorial(n()) / factorial(n() - j) * sumFactorX(j, j);
return (double) factorial(n()) / factorial(n() - j) * sumFactorX(j, j);
}

/**
Expand All @@ -253,7 +253,7 @@ private double sumFactorX(int j, int i) {
* @return
*/
public double cy(int j) {
return factorial(n()) / factorial(n() - j) * sumFactorY(j, j);
return (double) factorial(n()) / factorial(n() - j) * sumFactorY(j, j);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions CodenameOne/src/com/codename1/ui/plaf/DefaultLookAndFeel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1311,8 +1311,8 @@ private void drawComponent(Graphics g, Label l, Image icon, Image stateIcon, int
stateIconSize = stateIcon.getWidth(); //square image width == height
preserveSpaceForState = stateIconSize + gap;
stateIconYPosition = cmpY + topPadding
+ (cmpHeight - topPadding
- bottomPadding) / 2 - stateIconSize / 2;
+ (int) ((cmpHeight - topPadding
- bottomPadding) / 2f - stateIconSize / 2f);
int tX = cmpX;
if (((Button) l).isOppositeSide()) {
if (rtl) {
Expand Down Expand Up @@ -1538,7 +1538,7 @@ private void drawComponent(Graphics g, Label l, Image icon, Image stateIcon, int
}
if (badgeFont == null) {
if (Font.isNativeFontSchemeSupported()) {
badgeFont = Font.createTrueTypeFont(Font.NATIVE_MAIN_LIGHT).derive(fontHeight / 2, 0);
badgeFont = Font.createTrueTypeFont(Font.NATIVE_MAIN_LIGHT).derive(fontHeight / 2f, 0);
} else {
badgeFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
}
Expand Down
4 changes: 2 additions & 2 deletions CodenameOne/src/com/codename1/ui/plaf/RoundRectBorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ private GeneralPath createShape(int shapeW, int shapeH) {
}
widthF -= strokePx;
heightF -= strokePx;
x += strokePx / 2;
y += strokePx / 2;
x += strokePx / 2f;
y += strokePx / 2f;

if (strokePx % 2 == 1) {
x += 0.5f;
Expand Down
3 changes: 2 additions & 1 deletion CodenameOne/src/com/codename1/ui/plaf/StyleParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ private static float getMMValue(String val) {
case Style.UNIT_TYPE_DIPS:
return (float) v.getValue();
case Style.UNIT_TYPE_SCREEN_PERCENTAGE:
return (int) Math.round(Display.getInstance().getDisplayWidth() * v.getValue() / 100.0) / Display.getInstance().convertToPixels(1f);
return (float) Math.round(Display.getInstance().getDisplayWidth() * v.getValue() / 100.0)
/ Display.getInstance().convertToPixels(1f);
}
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions CodenameOne/src/com/codename1/ui/scene/PerspectiveCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ public Transform getTransform() {
float xfactor = -displayW / bottomRight[0];
float yfactor = -displayH / bottomRight[1];

currTransform.translate((float) dw / 2, y + h / 2, zNear);
currTransform.translate((float) dw / 2, y + h * 0.5f, zNear);
currTransform.scale(xfactor, yfactor, 1f);

//currTransform.translate((float)dw/2/xfactor, (y+h/2)/yfactor, 0);

currTransform.concatenate(perspectiveT);
float zState = 0f;
float cameraZ = -zNear - w / 2 * zState;
float cameraZ = -zNear - w * 0.5f * zState;
float cameraX = (float) -dw / 2;//-x-w/2;
float cameraY = -y - h / 2;
float cameraY = -y - h * 0.5f;
currTransform.translate(cameraX, cameraY, cameraZ);

//if ( transitionState == STATE_FLIP){
Expand Down
Loading