/** * Get the desired dimensions and scale for the bitmap to be placed in the location corresponding * to id. Caller must allocate the Dimensions object. * * @param key * @param outDim a {@link ImageCanvas.Dimensions} object to write results into */ @Override public void getDesiredDimensions(Object key, Dimensions outDim) { Utils.traceBeginSection("get desired dimensions"); int w = 0, h = 0; float scale = 0; final Integer pos = mDivisionMap.get(transformKeyToDivisionId(key)); if (pos != null && pos >= 0) { final int size = mDivisionMap.size(); switch (size) { case 0: break; case 1: w = mWidth; h = mHeight; scale = Dimensions.SCALE_ONE; break; case 2: w = mWidth / 2; h = mHeight; scale = Dimensions.SCALE_HALF; break; case 3: switch (pos) { case 0: w = mWidth / 2; h = mHeight; scale = Dimensions.SCALE_HALF; break; default: w = mWidth / 2; h = mHeight / 2; scale = Dimensions.SCALE_QUARTER; } break; case 4: w = mWidth / 2; h = mHeight / 2; scale = Dimensions.SCALE_QUARTER; break; } } outDim.width = w; outDim.height = h; outDim.scale = scale; Utils.traceEndSection(); }