Skip to content

Commit

Permalink
Fixes #2
Browse files Browse the repository at this point in the history
Fixes #2

Image shaders are refreshed when the image itself changes. This helps
change images on runtime without taking a bit hit on performance.
  • Loading branch information
Pkmmte committed Jul 20, 2014
1 parent 1b99285 commit c7a7d79
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,23 @@ public boolean dispatchTouchEvent(MotionEvent event)
public void invalidate(Rect dirty) {
super.invalidate(dirty);
image = drawableToBitmap(getDrawable());
if(shader != null || canvasSize > 0)
refreshBitmapShader();
}

public void invalidate(int l, int t, int r, int b) {
super.invalidate(l, t, r, b);
image = drawableToBitmap(getDrawable());
if(shader != null || canvasSize > 0)
refreshBitmapShader();
}

@Override
public void invalidate() {
super.invalidate();
image = drawableToBitmap(getDrawable());
if(shader != null || canvasSize > 0)
refreshBitmapShader();
}

@Override
Expand Down Expand Up @@ -350,6 +356,10 @@ public void refreshBitmapShader()
shader = new BitmapShader(Bitmap.createScaledBitmap(image, canvasSize, canvasSize, false), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
}

/**
* Returns whether or not this view is currently
* in its selected state.
*/
public boolean isSelected()
{
return this.isSelected;
Expand Down

0 comments on commit c7a7d79

Please sign in to comment.