refactor: hide backend Adapter handles
- static methods for backend adapters
This commit is contained in:
@@ -33,10 +33,9 @@ import android.graphics.drawable.BitmapDrawable;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
public final class AndroidGraphics extends CanvasAdapter {
|
public final class AndroidGraphics extends CanvasAdapter {
|
||||||
public static final AndroidGraphics INSTANCE = new AndroidGraphics();
|
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
g = INSTANCE;
|
CanvasAdapter.init(new AndroidGraphics());
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static android.graphics.Bitmap getAndroidBitmap(Bitmap bitmap) {
|
// public static android.graphics.Bitmap getAndroidBitmap(Bitmap bitmap) {
|
||||||
@@ -52,22 +51,22 @@ public final class AndroidGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap decodeBitmap(InputStream inputStream) {
|
public Bitmap decodeBitmapImpl(InputStream inputStream) {
|
||||||
return new AndroidBitmap(inputStream);
|
return new AndroidBitmap(inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paint getPaint() {
|
public Paint newPaintImpl() {
|
||||||
return new AndroidPaint();
|
return new AndroidPaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getBitmap(int width, int height, int format) {
|
public Bitmap newBitmapImpl(int width, int height, int format) {
|
||||||
return new AndroidBitmap(width, height, format);
|
return new AndroidBitmap(width, height, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Canvas getCanvas() {
|
public Canvas newCanvasImpl() {
|
||||||
return new AndroidCanvas();
|
return new AndroidCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +99,7 @@ public final class AndroidGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap loadBitmapAsset(String fileName) {
|
public Bitmap loadBitmapAssetImpl(String fileName) {
|
||||||
try {
|
try {
|
||||||
return createBitmap(fileName);
|
return createBitmap(fileName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class AndroidAssets extends AssetAdapter {
|
|||||||
Context mContext;
|
Context mContext;
|
||||||
|
|
||||||
public static void init(Context ctx) {
|
public static void init(Context ctx) {
|
||||||
g = new AndroidAssets(ctx);
|
AssetAdapter.init(new AndroidAssets(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
private AndroidAssets(Context ctx) {
|
private AndroidAssets(Context ctx) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import android.graphics.drawable.Drawable;
|
|||||||
public final class AndroidGraphics extends CanvasAdapter {
|
public final class AndroidGraphics extends CanvasAdapter {
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
g = new AndroidGraphics();
|
CanvasAdapter.init(new AndroidGraphics());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static android.graphics.Paint getAndroidPaint(Paint paint) {
|
public static android.graphics.Paint getAndroidPaint(Paint paint) {
|
||||||
@@ -46,12 +46,12 @@ public final class AndroidGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap decodeBitmap(InputStream inputStream) {
|
public Bitmap decodeBitmapImpl(InputStream inputStream) {
|
||||||
return new AndroidBitmap(inputStream);
|
return new AndroidBitmap(inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap loadBitmapAsset(String fileName) {
|
public Bitmap loadBitmapAssetImpl(String fileName) {
|
||||||
try {
|
try {
|
||||||
return createBitmap(fileName);
|
return createBitmap(fileName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -61,17 +61,17 @@ public final class AndroidGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paint getPaint() {
|
public Paint newPaintImpl() {
|
||||||
return new AndroidPaint();
|
return new AndroidPaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getBitmap(int width, int height, int format) {
|
public Bitmap newBitmapImpl(int width, int height, int format) {
|
||||||
return new AndroidBitmap(width, height, format);
|
return new AndroidBitmap(width, height, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Canvas getCanvas() {
|
public Canvas newCanvasImpl() {
|
||||||
return new AndroidCanvas();
|
return new AndroidCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,9 @@ import org.oscim.backend.canvas.Canvas;
|
|||||||
import org.oscim.backend.canvas.Paint;
|
import org.oscim.backend.canvas.Paint;
|
||||||
|
|
||||||
public class AwtGraphics extends CanvasAdapter {
|
public class AwtGraphics extends CanvasAdapter {
|
||||||
private static final AwtGraphics INSTANCE = new AwtGraphics();
|
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
g = INSTANCE;
|
CanvasAdapter.init(new AwtGraphics());
|
||||||
}
|
}
|
||||||
|
|
||||||
private AwtGraphics() {
|
private AwtGraphics() {
|
||||||
@@ -41,17 +40,17 @@ public class AwtGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paint getPaint() {
|
public Paint newPaintImpl() {
|
||||||
return new AwtPaint();
|
return new AwtPaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getBitmap(int width, int height, int format) {
|
public Bitmap newBitmapImpl(int width, int height, int format) {
|
||||||
return new AwtBitmap(width, height, format);
|
return new AwtBitmap(width, height, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Canvas getCanvas() {
|
public Canvas newCanvasImpl() {
|
||||||
return new AwtCanvas();
|
return new AwtCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +86,7 @@ public class AwtGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap decodeBitmap(InputStream inputStream) {
|
public Bitmap decodeBitmapImpl(InputStream inputStream) {
|
||||||
try {
|
try {
|
||||||
return new AwtBitmap(inputStream);
|
return new AwtBitmap(inputStream);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -97,7 +96,7 @@ public class AwtGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap loadBitmapAsset(String fileName) {
|
public Bitmap loadBitmapAssetImpl(String fileName) {
|
||||||
try {
|
try {
|
||||||
return createBitmap(fileName);
|
return createBitmap(fileName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -46,6 +46,6 @@ public class GdxAssets extends AssetAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void init(String path) {
|
public static void init(String path) {
|
||||||
g = new GdxAssets(path);
|
AssetAdapter.init(new GdxAssets(path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class JeoTileSource extends TileSource {
|
|||||||
sink.completed(TILE_NOT_FOUND);
|
sink.completed(TILE_NOT_FOUND);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bitmap b = CanvasAdapter.g.decodeBitmap(new ByteArrayInputStream(t.getData()));
|
Bitmap b = CanvasAdapter.decodeBitmap(new ByteArrayInputStream(t.getData()));
|
||||||
sink.setTileImage(b);
|
sink.setTileImage(b);
|
||||||
log.debug("success {}", tile);
|
log.debug("success {}", tile);
|
||||||
sink.completed(SUCCESS);
|
sink.completed(SUCCESS);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public abstract class SpriteManager<T> {
|
|||||||
|
|
||||||
Sprite items;
|
Sprite items;
|
||||||
|
|
||||||
protected final Canvas mCanvas = CanvasAdapter.g.getCanvas();
|
protected final Canvas mCanvas = CanvasAdapter.newCanvas();
|
||||||
protected TextureItem mTexture;
|
protected TextureItem mTexture;
|
||||||
|
|
||||||
public SpriteManager() {
|
public SpriteManager() {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class ThemeTest {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
AwtGraphics.init();
|
AwtGraphics.init();
|
||||||
AssetAdapter.g = new AssetAdapter() {
|
AssetAdapter.init(new AssetAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public InputStream openFileAsStream(String name) {
|
public InputStream openFileAsStream(String name) {
|
||||||
try {
|
try {
|
||||||
@@ -29,7 +29,7 @@ public class ThemeTest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
IRenderTheme t = ThemeLoader.load(VtmThemes.DEFAULT);
|
IRenderTheme t = ThemeLoader.load(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class SymbolRenderLayer extends ElementRenderer {
|
|||||||
it.billboard = false;
|
it.billboard = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
it.bitmap = CanvasAdapter.g.loadBitmapAsset("jar:symbols/cafe.png");
|
it.bitmap = CanvasAdapter.getBitmapAsset("jar:symbols/cafe.png");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,6 @@ public enum VtmThemes implements ThemeFile {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getRenderThemeAsStream() {
|
public InputStream getRenderThemeAsStream() {
|
||||||
return AssetAdapter.g.openFileAsStream(mPath);
|
return AssetAdapter.readFileAsStream(mPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public class GwtGdxGraphics extends CanvasAdapter {
|
|||||||
|
|
||||||
public static boolean NO_STROKE_TEXT = false;
|
public static boolean NO_STROKE_TEXT = false;
|
||||||
|
|
||||||
public static final GwtGdxGraphics INSTANCE = new GwtGdxGraphics();
|
|
||||||
static final Context2d ctx;
|
static final Context2d ctx;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -47,33 +46,32 @@ public class GwtGdxGraphics extends CanvasAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap decodeBitmap(InputStream in) {
|
public Bitmap decodeBitmapImpl(InputStream in) {
|
||||||
//ImageData data = new ImageData();
|
//ImageData data = new ImageData();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap loadBitmapAsset(String fileName) {
|
public Bitmap loadBitmapAssetImpl(String fileName) {
|
||||||
return new GwtBitmap(fileName);
|
return new GwtBitmap(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paint getPaint() {
|
public Paint newPaintImpl() {
|
||||||
return new GwtPaint();
|
return new GwtPaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getBitmap(int width, int height, int format) {
|
public Bitmap newBitmapImpl(int width, int height, int format) {
|
||||||
return new GwtBitmap(width, height, format);
|
return new GwtBitmap(width, height, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.oscim.backend.canvas.Canvas getCanvas() {
|
public org.oscim.backend.canvas.Canvas newCanvasImpl() {
|
||||||
return new GwtCanvas();
|
return new GwtCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
g = INSTANCE;
|
CanvasAdapter.init(new GwtGdxGraphics());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,20 +27,21 @@ import java.io.InputStreamReader;
|
|||||||
public abstract class AssetAdapter {
|
public abstract class AssetAdapter {
|
||||||
|
|
||||||
/** The instance provided by backend */
|
/** The instance provided by backend */
|
||||||
public static AssetAdapter g;
|
static AssetAdapter g;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open file from asset path as stream.
|
* Open file from asset path as stream.
|
||||||
*
|
|
||||||
* @param name the name
|
|
||||||
* @return the input stream
|
|
||||||
*/
|
*/
|
||||||
public abstract InputStream openFileAsStream(String name);
|
protected abstract InputStream openFileAsStream(String file);
|
||||||
|
|
||||||
public String openTextFile(String name) {
|
public static InputStream readFileAsStream(String file) {
|
||||||
|
return g.openFileAsStream(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String readTextFile(String file) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
InputStream is = g.openFileAsStream(name);
|
InputStream is = g.openFileAsStream(file);
|
||||||
if (is == null)
|
if (is == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -55,5 +56,10 @@ public abstract class AssetAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(AssetAdapter adapter) {
|
||||||
|
g = adapter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.oscim.backend.canvas.Paint;
|
|||||||
public abstract class CanvasAdapter {
|
public abstract class CanvasAdapter {
|
||||||
|
|
||||||
/** The instance provided by backend */
|
/** The instance provided by backend */
|
||||||
public static CanvasAdapter g;
|
static CanvasAdapter g;
|
||||||
|
|
||||||
/** The dpi. */
|
/** The dpi. */
|
||||||
public static float dpi = 240;
|
public static float dpi = 240;
|
||||||
@@ -42,14 +42,22 @@ public abstract class CanvasAdapter {
|
|||||||
*
|
*
|
||||||
* @return the canvas
|
* @return the canvas
|
||||||
*/
|
*/
|
||||||
public abstract Canvas getCanvas();
|
protected abstract Canvas newCanvasImpl();
|
||||||
|
|
||||||
|
public static Canvas newCanvas() {
|
||||||
|
return g.newCanvasImpl();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Paint.
|
* Create Paint.
|
||||||
*
|
*
|
||||||
* @return the paint
|
* @return the paint
|
||||||
*/
|
*/
|
||||||
public abstract Paint getPaint();
|
protected abstract Paint newPaintImpl();
|
||||||
|
|
||||||
|
public static Paint newPaint() {
|
||||||
|
return g.newPaintImpl();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create {@link Bitmap} with given dimensions.
|
* Create {@link Bitmap} with given dimensions.
|
||||||
@@ -59,7 +67,11 @@ public abstract class CanvasAdapter {
|
|||||||
* @param format the format
|
* @param format the format
|
||||||
* @return the bitmap
|
* @return the bitmap
|
||||||
*/
|
*/
|
||||||
public abstract Bitmap getBitmap(int width, int height, int format);
|
protected abstract Bitmap newBitmapImpl(int width, int height, int format);
|
||||||
|
|
||||||
|
public static Bitmap newBitmap(int width, int height, int format) {
|
||||||
|
return g.newBitmapImpl(width, height, format);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create {@link Bitmap} from InputStream.
|
* Create {@link Bitmap} from InputStream.
|
||||||
@@ -67,7 +79,11 @@ public abstract class CanvasAdapter {
|
|||||||
* @param inputStream the input stream
|
* @param inputStream the input stream
|
||||||
* @return the bitmap
|
* @return the bitmap
|
||||||
*/
|
*/
|
||||||
public abstract Bitmap decodeBitmap(InputStream inputStream);
|
protected abstract Bitmap decodeBitmapImpl(InputStream inputStream);
|
||||||
|
|
||||||
|
public static Bitmap decodeBitmap(InputStream inputStream) {
|
||||||
|
return g.decodeBitmapImpl(inputStream);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create {@link Bitmap} from bundled assets.
|
* Create {@link Bitmap} from bundled assets.
|
||||||
@@ -75,7 +91,11 @@ public abstract class CanvasAdapter {
|
|||||||
* @param fileName the file name
|
* @param fileName the file name
|
||||||
* @return the bitmap
|
* @return the bitmap
|
||||||
*/
|
*/
|
||||||
public abstract Bitmap loadBitmapAsset(String fileName);
|
protected abstract Bitmap loadBitmapAssetImpl(String fileName);
|
||||||
|
|
||||||
|
public static Bitmap getBitmapAsset(String fileName) {
|
||||||
|
return g.loadBitmapAssetImpl(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
protected static Bitmap createBitmap(String src) throws IOException {
|
protected static Bitmap createBitmap(String src) throws IOException {
|
||||||
if (src == null || src.length() == 0) {
|
if (src == null || src.length() == 0) {
|
||||||
@@ -89,8 +109,12 @@ public abstract class CanvasAdapter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bitmap bitmap = CanvasAdapter.g.decodeBitmap(inputStream);
|
Bitmap bitmap = decodeBitmap(inputStream);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static void init(CanvasAdapter adapter) {
|
||||||
|
g = adapter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class GLShader {
|
|||||||
|
|
||||||
public static int loadShader(String file) {
|
public static int loadShader(String file) {
|
||||||
String path = "shaders/" + file + ".glsl";
|
String path = "shaders/" + file + ".glsl";
|
||||||
String vs = AssetAdapter.g.openTextFile(path);
|
String vs = AssetAdapter.readTextFile(path);
|
||||||
|
|
||||||
if (vs == null)
|
if (vs == null)
|
||||||
throw new IllegalArgumentException("shader file not found: " + path);
|
throw new IllegalArgumentException("shader file not found: " + path);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class TextLayer extends TextureLayer {
|
|||||||
|
|
||||||
public TextLayer() {
|
public TextLayer() {
|
||||||
super(RenderElement.SYMBOL);
|
super(RenderElement.SYMBOL);
|
||||||
mCanvas = CanvasAdapter.g.getCanvas();
|
mCanvas = CanvasAdapter.newCanvas();
|
||||||
fixed = true;
|
fixed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ public class TextureItem extends Inlist<TextureItem> {
|
|||||||
synchronized (mBitmaps) {
|
synchronized (mBitmaps) {
|
||||||
int size = mBitmaps.size();
|
int size = mBitmaps.size();
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
t.bitmap = CanvasAdapter.g.getBitmap(mWidth, mHeight, 0);
|
t.bitmap = CanvasAdapter.newBitmap(mWidth, mHeight, 0);
|
||||||
else {
|
else {
|
||||||
t.bitmap = mBitmaps.remove(size - 1);
|
t.bitmap = mBitmaps.remove(size - 1);
|
||||||
t.bitmap.eraseColor(Color.TRANSPARENT);
|
t.bitmap.eraseColor(Color.TRANSPARENT);
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
|||||||
|
|
||||||
if (src != null) {
|
if (src != null) {
|
||||||
try {
|
try {
|
||||||
Bitmap bitmap = CanvasAdapter.g.loadBitmapAsset(src);
|
Bitmap bitmap = CanvasAdapter.getBitmapAsset(src);
|
||||||
if (bitmap != null)
|
if (bitmap != null)
|
||||||
b.texture = new TextureItem(bitmap, true);
|
b.texture = new TextureItem(bitmap, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -566,7 +566,7 @@ public class XmlThemeBuilder extends DefaultHandler {
|
|||||||
}
|
}
|
||||||
validateExists("img", img, elementName);
|
validateExists("img", img, elementName);
|
||||||
|
|
||||||
Bitmap bitmap = CanvasAdapter.g.loadBitmapAsset(IMG_PATH + img);
|
Bitmap bitmap = CanvasAdapter.getBitmapAsset(IMG_PATH + img);
|
||||||
mTextureAtlas = new TextureAtlas(bitmap);
|
mTextureAtlas = new TextureAtlas(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public final class TextStyle extends RenderStyle {
|
|||||||
this.priority = tb.priority;
|
this.priority = tb.priority;
|
||||||
this.texture = tb.texture;
|
this.texture = tb.texture;
|
||||||
|
|
||||||
paint = CanvasAdapter.g.getPaint();
|
paint = CanvasAdapter.newPaint();
|
||||||
paint.setTextAlign(Align.CENTER);
|
paint.setTextAlign(Align.CENTER);
|
||||||
paint.setTypeface(tb.fontFamily, tb.fontStyle);
|
paint.setTypeface(tb.fontFamily, tb.fontStyle);
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ public final class TextStyle extends RenderStyle {
|
|||||||
paint.setTextSize(tb.fontSize);
|
paint.setTextSize(tb.fontSize);
|
||||||
|
|
||||||
if (tb.strokeWidth > 0) {
|
if (tb.strokeWidth > 0) {
|
||||||
stroke = CanvasAdapter.g.getPaint();
|
stroke = CanvasAdapter.newPaint();
|
||||||
stroke.setStyle(Paint.Style.STROKE);
|
stroke.setStyle(Paint.Style.STROKE);
|
||||||
stroke.setTextAlign(Align.CENTER);
|
stroke.setTextAlign(Align.CENTER);
|
||||||
stroke.setTypeface(tb.fontFamily, tb.fontStyle);
|
stroke.setTypeface(tb.fontFamily, tb.fontStyle);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class BitmapTileSource extends UrlTileSource {
|
|||||||
public boolean decode(Tile tile, ITileDataSink sink, InputStream is)
|
public boolean decode(Tile tile, ITileDataSink sink, InputStream is)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
Bitmap bitmap = CanvasAdapter.g.decodeBitmap(is);
|
Bitmap bitmap = CanvasAdapter.decodeBitmap(is);
|
||||||
if (!bitmap.isValid()) {
|
if (!bitmap.isValid()) {
|
||||||
log.debug("{} invalid bitmap", tile);
|
log.debug("{} invalid bitmap", tile);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user