add Color.isOpaque util
This commit is contained in:
parent
7b9301d479
commit
3f3dca30d7
@ -21,6 +21,8 @@ import org.oscim.utils.FastMath;
|
||||
|
||||
public final class Color {
|
||||
|
||||
private static final int OPAQUE = 0xff000000;
|
||||
|
||||
public static int fadePremul(int color, double alpha) {
|
||||
alpha = FastMath.clamp(alpha, 0, 1);
|
||||
|
||||
@ -239,7 +241,10 @@ public final class Color {
|
||||
return fallBackColor;
|
||||
}
|
||||
|
||||
public static boolean isOpaque(int color) {
|
||||
return (color & OPAQUE) == OPAQUE;
|
||||
}
|
||||
|
||||
private Color() {
|
||||
/* Singleton */
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import static org.oscim.utils.FastMath.clamp;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.Tile;
|
||||
@ -155,7 +156,6 @@ public final class PolygonBucket extends RenderBucket {
|
||||
|
||||
public static final class Renderer {
|
||||
|
||||
private static final int OPAQUE = 0xff000000;
|
||||
private static final int STENCIL_BITS = 8;
|
||||
public final static int CLIP_BIT = 0x80;
|
||||
|
||||
@ -216,7 +216,7 @@ public final class PolygonBucket extends RenderBucket {
|
||||
a.blendColor, blendFill);
|
||||
}
|
||||
} else {
|
||||
blend |= (a.color & OPAQUE) != OPAQUE;
|
||||
blend |= !Color.isOpaque(a.color);
|
||||
GLUtils.setColor(s.uColor, a.color, fade);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ import org.oscim.utils.FastMath;
|
||||
* - create distance field per tile?
|
||||
*/
|
||||
public class AreaStyle extends RenderStyle {
|
||||
private static final int OPAQUE = 0xff000000;
|
||||
|
||||
private static final float FADE_START = 0.25f;
|
||||
|
||||
/** Drawing order level */
|
||||
@ -95,7 +95,7 @@ public class AreaStyle extends RenderStyle {
|
||||
}
|
||||
|
||||
public boolean hasAlpha(int zoom) {
|
||||
if ((color & OPAQUE) != OPAQUE)
|
||||
if (!Color.isOpaque(color))
|
||||
return true;
|
||||
|
||||
if (texture != null)
|
||||
@ -105,7 +105,7 @@ public class AreaStyle extends RenderStyle {
|
||||
return false;
|
||||
|
||||
if (zoom >= blendScale) {
|
||||
if ((blendColor & OPAQUE) != OPAQUE)
|
||||
if (!Color.isOpaque(blendColor))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user