mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
fix crash creating light-colored arrow
Changing it to a VectorDrawable meant it crashed code that assumed otherwise. Fix by removing the assumption.
This commit is contained in:
parent
4c0c57229f
commit
effbc3ef00
1 changed files with 9 additions and 5 deletions
|
@ -919,8 +919,13 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
||||||
Drawable arrow = res.getDrawable( resID );
|
Drawable arrow = res.getDrawable( resID );
|
||||||
|
|
||||||
if ( !useDark ) {
|
if ( !useDark ) {
|
||||||
Bitmap src = ((BitmapDrawable)arrow).getBitmap();
|
Bitmap bitmap = Bitmap.createBitmap( arrow.getIntrinsicWidth(),
|
||||||
Bitmap bitmap = src.copy( Bitmap.Config.ARGB_8888, true );
|
arrow.getIntrinsicHeight(),
|
||||||
|
Bitmap.Config.ARGB_8888 );
|
||||||
|
Canvas canvas = new Canvas( bitmap );
|
||||||
|
arrow.setBounds( 0, 0, canvas.getWidth(), canvas.getHeight() );
|
||||||
|
arrow.draw( canvas );
|
||||||
|
|
||||||
for ( int xx = 0; xx < bitmap.getWidth(); ++xx ) {
|
for ( int xx = 0; xx < bitmap.getWidth(); ++xx ) {
|
||||||
for ( int yy = 0; yy < bitmap.getHeight(); ++yy ) {
|
for ( int yy = 0; yy < bitmap.getHeight(); ++yy ) {
|
||||||
if ( BLACK == bitmap.getPixel( xx, yy ) ) {
|
if ( BLACK == bitmap.getPixel( xx, yy ) ) {
|
||||||
|
@ -928,7 +933,6 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arrow = new BitmapDrawable( bitmap );
|
arrow = new BitmapDrawable( bitmap );
|
||||||
}
|
}
|
||||||
return arrow;
|
return arrow;
|
||||||
|
|
Loading…
Reference in a new issue