From 6435b9c7fafd294680a3be589deb61de2fdb3d3c Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 22 Dec 2015 18:04:29 +0300 Subject: [PATCH] 0027031: Samples - fix compilation issues in java/jniviewer sample Add -std=c++11 compiler flag to Android.mk. OcctJni_Viewer - drop removed arguments within V3d_View::SetWindow() usage. OcctJni_Window - add missing NativeFBConfig() method declared in the interface. --- samples/java/jniviewer/jni/Android.mk | 2 +- samples/java/jniviewer/jni/OcctJni_Viewer.cxx | 6 ++-- samples/java/jniviewer/jni/OcctJni_Window.hxx | 35 ++++++++++--------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/samples/java/jniviewer/jni/Android.mk b/samples/java/jniviewer/jni/Android.mk index 912d5e3be3..c944ec8910 100644 --- a/samples/java/jniviewer/jni/Android.mk +++ b/samples/java/jniviewer/jni/Android.mk @@ -200,7 +200,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := libTKJniSample LOCAL_C_INCLUDES := $(STL_INC) #LOCAL_STATIC_LIBRARIES := $(STL_LIB) does not work -LOCAL_CFLAGS := -Wall +LOCAL_CFLAGS := -Wall -std=c++11 LOCAL_CPP_EXTENSION := .cxx .cpp LOCAL_CPP_FEATURES := rtti exceptions LOCAL_SRC_FILES := OcctJni_Viewer.cxx OcctJni_Window.cxx OcctJni_MsgPrinter.cxx diff --git a/samples/java/jniviewer/jni/OcctJni_Viewer.cxx b/samples/java/jniviewer/jni/OcctJni_Viewer.cxx index 750f030e91..5098513e1f 100644 --- a/samples/java/jniviewer/jni/OcctJni_Viewer.cxx +++ b/samples/java/jniviewer/jni/OcctJni_Viewer.cxx @@ -179,7 +179,7 @@ bool OcctJni_Viewer::init() } aWindow->SetSize (aWidth, aHeight); - myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL); + myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext); return true; } @@ -208,7 +208,7 @@ bool OcctJni_Viewer::init() Handle(OcctJni_Window) aWindow = new OcctJni_Window (aWidth, aHeight); myView = myViewer->CreateView(); - myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL); + myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext); myView->TriedronDisplay (Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_WHITE, 0.08, V3d_ZBUFFER); initContent(); @@ -245,7 +245,7 @@ void OcctJni_Viewer::resize (int theWidth, //myView->MustBeResized(); // can be used instead of SetWindow() when EGLsurface has not been changed EGLContext anEglContext = eglGetCurrentContext(); - myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext, NULL, NULL); + myView->SetWindow (aWindow, (Aspect_RenderingContext )anEglContext); //saveSnapshot ("/sdcard/Download/tt.png", theWidth, theHeight); } diff --git a/samples/java/jniviewer/jni/OcctJni_Window.hxx b/samples/java/jniviewer/jni/OcctJni_Window.hxx index a8e38c96a1..f8cd2dad3c 100644 --- a/samples/java/jniviewer/jni/OcctJni_Window.hxx +++ b/samples/java/jniviewer/jni/OcctJni_Window.hxx @@ -27,36 +27,39 @@ public: : myWidth (theWidth), myHeight(theHeight) {} //! Returns native Window handle - virtual Aspect_Drawable NativeHandle() const { return 0; } + virtual Aspect_Drawable NativeHandle() const Standard_OVERRIDE { return 0; } //! Returns parent of native Window handle - virtual Aspect_Drawable NativeParentHandle() const { return 0; } + virtual Aspect_Drawable NativeParentHandle() const Standard_OVERRIDE { return 0; } + + //! Returns nothing on Android + virtual Aspect_FBConfig NativeFBConfig() const Standard_OVERRIDE { return 0; } virtual void Destroy() {} //! Opens the window - virtual void Map() const {} + virtual void Map() const Standard_OVERRIDE {} //! Closes the window - virtual void Unmap() const {} + virtual void Unmap() const Standard_OVERRIDE {} //! Applies the resizing to the window - virtual Aspect_TypeOfResize DoResize() const { return Aspect_TOR_UNKNOWN; } + virtual Aspect_TypeOfResize DoResize() const Standard_OVERRIDE { return Aspect_TOR_UNKNOWN; } //! Apply the mapping change to the window - virtual Standard_Boolean DoMapping() const { return Standard_True; } + virtual Standard_Boolean DoMapping() const Standard_OVERRIDE { return Standard_True; } //! Returns True if the window is opened - virtual Standard_Boolean IsMapped() const { return Standard_True; } + virtual Standard_Boolean IsMapped() const Standard_OVERRIDE { return Standard_True; } //! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions - virtual Quantity_Ratio Ratio() const { return 1.0; } + virtual Quantity_Ratio Ratio() const Standard_OVERRIDE { return 1.0; } //! Returns The Window POSITION in PIXEL virtual void Position (Standard_Integer& theX1, Standard_Integer& theY1, Standard_Integer& theX2, - Standard_Integer& theY2) const + Standard_Integer& theY2) const Standard_OVERRIDE { theX1 = 0; theX2 = myWidth; @@ -65,10 +68,10 @@ public: } //! Set The Window POSITION in PIXEL - virtual void SetPosition (const Standard_Integer theX1, - const Standard_Integer theY1, - const Standard_Integer theX2, - const Standard_Integer theY2) + void SetPosition (const Standard_Integer theX1, + const Standard_Integer theY1, + const Standard_Integer theX2, + const Standard_Integer theY2) { myWidth = theX2 - theX1; myHeight = theY2 - theY1; @@ -76,15 +79,15 @@ public: //! Returns The Window SIZE in PIXEL virtual void Size (Standard_Integer& theWidth, - Standard_Integer& theHeight) const + Standard_Integer& theHeight) const Standard_OVERRIDE { theWidth = myWidth; theHeight = myHeight; } //! Set The Window SIZE in PIXEL - virtual void SetSize (const Standard_Integer theWidth, - const Standard_Integer theHeight) + void SetSize (const Standard_Integer theWidth, + const Standard_Integer theHeight) { myWidth = theWidth; myHeight = theHeight; -- 2.20.1