forked from organicmaps/organicmaps
Review fixes
This commit is contained in:
parent
34ac6ce77f
commit
44f618289a
4 changed files with 30 additions and 38 deletions
|
@ -6,43 +6,43 @@ extern "C"
|
|||
{
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_RenderFragment_CreateEngine(JNIEnv * env, jobject thiz, jobject surface, jint destiny)
|
||||
Java_com_mapswithme_maps_RenderFragment_createEngine(JNIEnv * env, jobject thiz, jobject surface, jint destiny)
|
||||
{
|
||||
return static_cast<jboolean>(g_framework->CreateDrapeEngine(env, surface, static_cast<int>(destiny)));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_RenderFragment_SurfaceResized(JNIEnv * env, jobject thiz, jint w, jint h)
|
||||
Java_com_mapswithme_maps_RenderFragment_surfaceResized(JNIEnv * env, jobject thiz, jint w, jint h)
|
||||
{
|
||||
g_framework->Resize(static_cast<int>(w), static_cast<int>(h));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_RenderFragment_DestroyEngine(JNIEnv * env, jobject thiz)
|
||||
Java_com_mapswithme_maps_RenderFragment_destroyEngine(JNIEnv * env, jobject thiz)
|
||||
{
|
||||
g_framework->DeleteDrapeEngine();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_RenderFragment_IsEngineCreated(JNIEnv * env, jobject thiz)
|
||||
Java_com_mapswithme_maps_RenderFragment_isEngineCreated(JNIEnv * env, jobject thiz)
|
||||
{
|
||||
return static_cast<jboolean>(g_framework->IsDrapeEngineCreated());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_RenderFragment_DetachSurface(JNIEnv * env, jobject thiz)
|
||||
Java_com_mapswithme_maps_RenderFragment_detachSurface(JNIEnv * env, jobject thiz)
|
||||
{
|
||||
g_framework->DetachSurface();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_RenderFragment_AttachSurface(JNIEnv * env, jobject thiz, jobject surface)
|
||||
Java_com_mapswithme_maps_RenderFragment_attachSurface(JNIEnv * env, jobject thiz, jobject surface)
|
||||
{
|
||||
g_framework->AttachSurface(env, surface);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_RenderFragment_OnTouch(JNIEnv * env, jobject thiz, jint action, jboolean hasFirst, jboolean hasSecond,
|
||||
Java_com_mapswithme_maps_RenderFragment_onTouch(JNIEnv * env, jobject thiz, jint action, jboolean hasFirst, jboolean hasSecond,
|
||||
jfloat x1, jfloat y1, jfloat x2, jfloat y2)
|
||||
{
|
||||
int mask = 0;
|
||||
|
|
|
@ -43,9 +43,7 @@ AndroidOGLContext::~AndroidOGLContext()
|
|||
{
|
||||
// Native context must exist
|
||||
if (eglDestroyContext(m_display, m_nativeContext) == EGL_FALSE)
|
||||
{
|
||||
CHECK_EGL_CALL();
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidOGLContext::setDefaultFramebuffer()
|
||||
|
@ -57,9 +55,7 @@ void AndroidOGLContext::makeCurrent()
|
|||
{
|
||||
ASSERT(m_surface != EGL_NO_SURFACE, ());
|
||||
if (eglMakeCurrent(m_display, m_surface, m_surface, m_nativeContext) == EGL_FALSE)
|
||||
{
|
||||
CHECK_EGL_CALL();
|
||||
}
|
||||
|
||||
if (m_csaaUsed)
|
||||
{
|
||||
|
@ -76,9 +72,7 @@ void AndroidOGLContext::makeCurrent()
|
|||
void AndroidOGLContext::clearCurrent()
|
||||
{
|
||||
if (eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_FALSE)
|
||||
{
|
||||
CHECK_EGL_CALL();
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidOGLContext::setRenderingEnabled(bool enabled)
|
||||
|
@ -93,9 +87,7 @@ void AndroidOGLContext::present()
|
|||
{
|
||||
ASSERT(m_surface != EGL_NO_SURFACE, ());
|
||||
if (eglSwapBuffers(m_display, m_surface) == EGL_FALSE)
|
||||
{
|
||||
CHECK_EGL_CALL();
|
||||
}
|
||||
}
|
||||
|
||||
int AndroidOGLContext::additionClearFlags()
|
||||
|
|
|
@ -76,7 +76,7 @@ public class MapFragment extends RenderFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void OnRenderingInitialized()
|
||||
public void onRenderingInitialized()
|
||||
{
|
||||
final Activity host = getActivity();
|
||||
if (isAdded() && host instanceof MapRenderingListener)
|
||||
|
@ -89,7 +89,7 @@ public class MapFragment extends RenderFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void ReportUnsupported()
|
||||
public void reportUnsupported()
|
||||
{
|
||||
getActivity().runOnUiThread(new Runnable()
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
|
@ -30,8 +29,8 @@ public abstract class RenderFragment extends BaseMwmFragment
|
|||
public void surfaceCreated(SurfaceHolder surfaceHolder)
|
||||
{
|
||||
mSurfaceHolder = surfaceHolder;
|
||||
if (IsEngineCreated())
|
||||
AttachSurface(mSurfaceHolder.getSurface());
|
||||
if (isEngineCreated())
|
||||
attachSurface(mSurfaceHolder.getSurface());
|
||||
else
|
||||
InitEngine();
|
||||
}
|
||||
|
@ -39,7 +38,7 @@ public abstract class RenderFragment extends BaseMwmFragment
|
|||
@Override
|
||||
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int w, int h)
|
||||
{
|
||||
SurfaceResized(w, h);
|
||||
surfaceResized(w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,11 +50,11 @@ public abstract class RenderFragment extends BaseMwmFragment
|
|||
getActivity() == null || !getActivity().isChangingConfigurations())
|
||||
{
|
||||
MWMApplication.get().clearFunctorsOnUiThread();
|
||||
DestroyEngine();
|
||||
destroyEngine();
|
||||
}
|
||||
else
|
||||
{
|
||||
DetachSurface();
|
||||
detachSurface();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +111,7 @@ public abstract class RenderFragment extends BaseMwmFragment
|
|||
final float x0 = event.getX();
|
||||
final float y0 = event.getY();
|
||||
|
||||
return OnTouch(action, true, false, x0, y0, 0, 0);
|
||||
return onTouch(action, true, false, x0, y0, 0, 0);
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
@ -123,9 +122,9 @@ public abstract class RenderFragment extends BaseMwmFragment
|
|||
final float y1 = event.getY(1);
|
||||
|
||||
if (event.getPointerId(0) == mLastPointerId)
|
||||
return OnTouch(action, true, true, x0, y0, x1, y1);
|
||||
return onTouch(action, true, true, x0, y0, x1, y1);
|
||||
else
|
||||
return OnTouch(action, true, true, x1, y1, x0, y0);
|
||||
return onTouch(action, true, true, x1, y1, x0, y0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,21 +135,22 @@ public abstract class RenderFragment extends BaseMwmFragment
|
|||
{
|
||||
if (mSurfaceHolder != null)
|
||||
{
|
||||
if (CreateEngine(mSurfaceHolder.getSurface(), m_displayDensity))
|
||||
OnRenderingInitialized();
|
||||
if (createEngine(mSurfaceHolder.getSurface(), m_displayDensity))
|
||||
onRenderingInitialized();
|
||||
else
|
||||
ReportUnsupported();
|
||||
reportUnsupported();
|
||||
}
|
||||
}
|
||||
|
||||
abstract public void OnRenderingInitialized();
|
||||
abstract public void ReportUnsupported();
|
||||
abstract public void onRenderingInitialized();
|
||||
abstract public void reportUnsupported();
|
||||
|
||||
private native boolean CreateEngine(Surface surface, int density);
|
||||
private native boolean IsEngineCreated();
|
||||
private native void SurfaceResized(int w, int h);
|
||||
private native void DestroyEngine();
|
||||
private native void DetachSurface();
|
||||
private native void AttachSurface(Surface surface);
|
||||
private native boolean OnTouch(int actionType, boolean hasFirst, boolean hasSecond, float x1, float y1, float x2, float y2);
|
||||
private native boolean createEngine(Surface surface, int density);
|
||||
private native boolean isEngineCreated();
|
||||
private native void surfaceResized(int w, int h);
|
||||
private native void destroyEngine();
|
||||
private native void detachSurface();
|
||||
private native void attachSurface(Surface surface);
|
||||
private native boolean onTouch(int actionType, boolean hasFirst, boolean hasSecond, float x1, float y1, float x2, float y2);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue