blob: ad25dea0d30e72edad56483202ab80082b15b0b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
package com.mapbox.mapboxsdk.maps.renderer.textureview;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.TextureView;
import com.mapbox.mapboxsdk.maps.renderer.MapRenderer;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
/**
* The {@link TextureViewMapRenderer} encapsulates the GL thread and
* {@link TextureView} specifics to render the map.
*
* @see MapRenderer
*/
public class TextureViewMapRenderer extends MapRenderer {
private TextureViewRenderThread renderThread;
private boolean translucentSurface;
/**
* Create a {@link MapRenderer} for the given {@link TextureView}
*
* @param context the current Context
* @param textureView the TextureView
* @param localIdeographFontFamily the local font family
* @param translucentSurface the translucency flag
*/
public TextureViewMapRenderer(@NonNull Context context,
@NonNull TextureView textureView,
String localIdeographFontFamily,
boolean translucentSurface) {
super(context, localIdeographFontFamily);
this.translucentSurface = translucentSurface;
renderThread = new TextureViewRenderThread(textureView, this);
renderThread.start();
}
/**
* Overridden to provide package access
*/
@Override
protected void onSurfaceCreated(GL10 gl, EGLConfig config) {
super.onSurfaceCreated(gl, config);
}
/**
* Overridden to provide package access
*/
@Override
protected void onSurfaceChanged(GL10 gl, int width, int height) {
super.onSurfaceChanged(gl, width, height);
}
/**
* Overridden to provide package access
*/
@Override
protected void onDrawFrame(GL10 gl) {
super.onDrawFrame(gl);
}
/**
* {@inheritDoc}
*/
@Override
public void requestRender() {
renderThread.requestRender();
}
/**
* {@inheritDoc}
*/
@Override
public void queueEvent(Runnable runnable) {
renderThread.queueEvent(runnable);
}
/**
* {@inheritDoc}
*/
@Override
public void onStop() {
renderThread.onPause();
}
/**
* {@inheritDoc}
*/
@Override
public void onStart() {
renderThread.onResume();
}
/**
* {@inheritDoc}
*/
@Override
public void onDestroy() {
renderThread.onDestroy();
}
public boolean isTranslucentSurface() {
return translucentSurface;
}
}
|