public synchronized void setHardwareSpecs(Hardware hardware) { model = hardware.getModel(); font = hardware.getFont(); trsScreenCols = hardware.getScreenConfiguration().trsScreenCols; trsScreenRows = hardware.getScreenConfiguration().trsScreenRows; trsCharWidth = hardware.getCharWidth(); trsCharHeight = hardware.getCharHeight(); screenCharBuffer = new StringBuilder(trsScreenCols * trsScreenRows + trsScreenRows); lastScreenBuffer = new short[trsScreenCols * trsScreenRows]; Arrays.fill(lastScreenBuffer, Short.MAX_VALUE); }
public synchronized Bitmap takeScreenshot(Hardware hardware) { Bitmap screenshot = Bitmap.createBitmap(hardware.getScreenWidth(), hardware.getScreenHeight(), Config.RGB_565); boolean expandedMode = XTRS.isExpandedMode(); int d = expandedMode ? 2 : 1; dirtyRectLeft = dirtyRectTop = 0; dirtyRectRight = trsScreenCols / d - 1; dirtyRectBottom = trsScreenRows - 1; Canvas c = new Canvas(screenshot); renderScreenToCanvas(c, expandedMode); return screenshot; }