Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -658,26 +658,14 @@ protected void getProperBaseMatrix( Drawable drawable, Matrix matrix ) {
float widthScale, heightScale;
matrix.reset();

if ( w > viewWidth || h > viewHeight ) {
widthScale = viewWidth / w;
heightScale = viewHeight / h;
float scale = Math.min( widthScale, heightScale );
matrix.postScale( scale, scale );

float tw = ( viewWidth - w * scale ) / 2.0f;
float th = ( viewHeight - h * scale ) / 2.0f;
matrix.postTranslate( tw, th );

} else {
widthScale = viewWidth / w;
heightScale = viewHeight / h;
float scale = Math.min( widthScale, heightScale );
matrix.postScale( scale, scale );
widthScale = viewWidth / w;
heightScale = viewHeight / h;
float scale = Math.min( widthScale, heightScale );
matrix.postScale( scale, scale );

float tw = ( viewWidth - w * scale ) / 2.0f;
float th = ( viewHeight - h * scale ) / 2.0f;
matrix.postTranslate( tw, th );
}
float tw = ( viewWidth - w * scale ) / 2.0f;
float th = ( viewHeight - h * scale ) / 2.0f;
matrix.postTranslate( tw, th );

if( LOG_ENABLED ) {
printMatrix( matrix );
Expand Down