forked from mirror/monocles_chat_clean
look at only subset of pixels to check for alpha
(cherry picked from commit ca496fd39fcc1ca11b66961d57212a76805160e0) # Conflicts: # src/main/java/eu/siacs/conversations/persistance/FileBackend.java
This commit is contained in:
parent
7fc54e4cc9
commit
d8a7d87a12
1 changed files with 6 additions and 3 deletions
|
@ -866,10 +866,13 @@ public class FileBackend {
|
|||
return getUriForFile(mXmppConnectionService, file);
|
||||
}
|
||||
|
||||
|
||||
private static boolean hasAlpha(final Bitmap bitmap) {
|
||||
for (int x = 0; x < bitmap.getWidth(); ++x) {
|
||||
for (int y = 0; y < bitmap.getWidth(); ++y) {
|
||||
final int w = bitmap.getWidth();
|
||||
final int h = bitmap.getHeight();
|
||||
final int yStep = Math.max(1, w / 100);
|
||||
final int xStep = Math.max(1, h / 100);
|
||||
for (int x = 0; x < w; x += xStep) {
|
||||
for (int y = 0; y < h; y += yStep) {
|
||||
if (Color.alpha(bitmap.getPixel(x, y)) < 255) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue