Revision 2bd3d0fb
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/main/DistortedTexture.java | ||
---|---|---|
135 | 135 |
* to GLSurfaceView.onSurfaceCreated) because only after this point can the Library upload it to the GPU! |
136 | 136 |
* |
137 | 137 |
* @param bmp The android.graphics.Bitmap object to apply effects to and display. |
138 |
* @return true if successful, false if texture too large. |
|
138 | 139 |
*/ |
139 |
public void setTexture(Bitmap bmp)
|
|
140 |
public boolean setTexture(Bitmap bmp)
|
|
140 | 141 |
{ |
141 |
mBmp= bmp; |
|
142 |
markForCreation(); |
|
142 |
int width = bmp.getWidth(); |
|
143 |
int height= bmp.getHeight(); |
|
144 |
int max = DistortedLibrary.getMaxTextureSize(); |
|
145 |
|
|
146 |
if( width>max || height>max ) |
|
147 |
{ |
|
148 |
android.util.Log.e("texture","error, trying to upload too large texture of size "+width+" x "+height+". Max is "+max); |
|
149 |
return false; |
|
150 |
} |
|
151 |
else |
|
152 |
{ |
|
153 |
mBmp= bmp; |
|
154 |
markForCreation(); |
|
155 |
return true; |
|
156 |
} |
|
143 | 157 |
} |
144 | 158 |
|
145 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Detect if the texture we are trying to upload is too large and return an error.