Created
September 3, 2015 20:33
-
-
Save mr5z/ad44e03e83e1ff4e367f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void scaleMatrix(int screenWidth, int screenHeight) { | |
// Title bar height | |
int shift = 100; | |
int maxWidth = 800; | |
int maxHeight = 1280 - shift; | |
int height = screenHeight - ((shift * screenHeight) / maxHeight); | |
float xDpi = getResources().getDisplayMetrics().xdpi; | |
float yDpi = getResources().getDisplayMetrics().xdpi; | |
float density = getResources().getDisplayMetrics().density; | |
for(int i = 0;i < mSegmentOffsetX.length; ++i) { | |
float uniformCoffeeX = BITMAP_RAW_WIDTH / BITMAP_WIDTH; | |
mSegmentOffsetX[i] = (mSegmentOffsetX[i] * screenWidth * uniformCoffeeX); | |
} | |
for(int i = 0;i < mSegmentCoords.length; i += 4) { | |
// mSegmentCoords[i + 0] = (mSegmentCoords[i + 0] * screenWidth * density) / maxWidth; | |
// mSegmentCoords[i + 1] = ((mSegmentCoords[i + 1] * height * density) / maxHeight); | |
// mSegmentCoords[i + 2] = (mSegmentCoords[i + 2] * screenWidth * density) / maxWidth; | |
// mSegmentCoords[i + 3] = ((mSegmentCoords[i + 3] * height * density) / maxHeight); | |
float uniformCoffeeX = BITMAP_RAW_WIDTH / BITMAP_WIDTH; | |
float uniformCoffeeY = BITMAP_RAW_HEIGHT / BITMAP_HEIGHT; | |
mSegmentCoords[i + 0] = (mSegmentCoords[i + 0] * screenWidth * uniformCoffeeX); | |
mSegmentCoords[i + 1] = ((mSegmentCoords[i + 1] * height * uniformCoffeeY)); | |
mSegmentCoords[i + 2] = (mSegmentCoords[i + 2] * screenWidth * uniformCoffeeX); | |
mSegmentCoords[i + 3] = ((mSegmentCoords[i + 3] * height * uniformCoffeeY)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment