Skip to content
Snippets Groups Projects
Commit b3c96ef5 authored by Leonard Kupper's avatar Leonard Kupper
Browse files

Update RasterCanvas to calculate dot rectangle only once, not on every request.

parent 5ee5e703
No related branches found
No related tags found
1 merge request!8Feat/rasterizer 10
......@@ -30,6 +30,7 @@ public class RasterCanvas extends AbstractCanvas {
// Printing area rectangle
private Rectangle mPrintingAreaCells;
private Rectangle mPrintingAreaDots;
// Cell size
private int mCellWidth; // dots
......@@ -148,8 +149,10 @@ public class RasterCanvas extends AbstractCanvas {
mVerticalCellCount = mPrintingAreaCells.intWrapper().getBottom() + 1; // How many full cells fit vertically?
// To how many dots does this raster size correspond?
mColumnCount = mHorizontalCellCount * mCellWidth;
mRowCount = mVerticalCellCount * mCellHeight;
mPrintingAreaDots = toDotRectangle(mPrintingAreaCells);
mColumnCount = mPrintingAreaDots.intWrapper().getWidth();
mRowCount = mPrintingAreaDots.intWrapper().getHeight();
}
......@@ -206,7 +209,7 @@ public class RasterCanvas extends AbstractCanvas {
return new Rectangle(mPrintingAreaCells);
}
public final Rectangle getDotRectangle() {
return toDotRectangle(mPrintingAreaCells);
return mPrintingAreaDots;
}
public final Rectangle toDotRectangle(final Rectangle cellRectangle) {
return cellRectangle.scaledBy(mCellWidth, mCellHeight);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment