Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69726597 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Add stencil buffer to the EGL config"

parents 4d6da864 530041d3
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -268,6 +268,24 @@ class GLES20Canvas extends HardwareCanvas {

    private static native void nFinish(int renderer);

    /**
     * Returns the size of the stencil buffer required by the underlying
     * implementation.
     * 
     * @return The minimum number of bits the stencil buffer must. Always >= 0.
     * 
     * @hide
     */
    public static int getStencilSize() {
        return nGetStencilSize();
    }

    private static native int nGetStencilSize();

    ///////////////////////////////////////////////////////////////////////////
    // Functor
    ///////////////////////////////////////////////////////////////////////////

    @Override
    public boolean callDrawGLFunction(int drawGLFunction) {
        return nCallDrawGLFunction(mRenderer, drawGLFunction);
@@ -275,7 +293,6 @@ class GLES20Canvas extends HardwareCanvas {

    private static native boolean nCallDrawGLFunction(int renderer, int drawGLFunction);


    ///////////////////////////////////////////////////////////////////////////
    // Memory
    ///////////////////////////////////////////////////////////////////////////
+1 −1
Original line number Diff line number Diff line
@@ -1047,7 +1047,7 @@ public abstract class HardwareRenderer {
                    EGL_BLUE_SIZE, 8,
                    EGL_ALPHA_SIZE, 8,
                    EGL_DEPTH_SIZE, 0,
                    EGL_STENCIL_SIZE, 0,
                    EGL_STENCIL_SIZE, GLES20Canvas.getStencilSize(),
                    EGL_SURFACE_TYPE, EGL_WINDOW_BIT |
                            (dirtyRegions ? EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0),
                    EGL_NONE
+10 −0
Original line number Diff line number Diff line
@@ -188,6 +188,14 @@ static void android_view_GLES20Canvas_finish(JNIEnv* env, jobject clazz,
    renderer->finish();
}

static jint android_view_GLES20Canvas_getStencilSize(JNIEnv* env, jobject clazz) {
    return OpenGLRenderer::getStencilSize();
}

// ----------------------------------------------------------------------------
// Functor
// ----------------------------------------------------------------------------

static bool android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject clazz,
        OpenGLRenderer* renderer, Functor *functor) {
    android::uirenderer::Rect dirty;
@@ -808,6 +816,8 @@ static JNINativeMethod gMethods[] = {
    { "nPrepareDirty",      "(IIIIIZ)V",       (void*) android_view_GLES20Canvas_prepareDirty },
    { "nFinish",            "(I)V",            (void*) android_view_GLES20Canvas_finish },

    { "nGetStencilSize",    "()I",             (void*) android_view_GLES20Canvas_getStencilSize },

    { "nCallDrawGLFunction", "(II)Z",
            (void*) android_view_GLES20Canvas_callDrawGLFunction },

+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ and each View is responsible for drawing itself.

   <p>
   The measure pass uses two classes to communicate dimensions. The
   {@link android.view.View.MeasureSpec} class is used by Views to tell their parents how they
   {@link android.view.ViewGroup.LayoutParams} class is used by Views to tell their parents how they
   want to be measured and positioned. The base LayoutParams class just
   describes how big the View wants to be for both width and height. For each
   dimension, it can specify one of:</p>
+4 −0
Original line number Diff line number Diff line
@@ -127,6 +127,10 @@ OpenGLRenderer::~OpenGLRenderer() {
// Setup
///////////////////////////////////////////////////////////////////////////////

uint32_t OpenGLRenderer::getStencilSize() {
    return STENCIL_BUFFER_SIZE;
}

void OpenGLRenderer::setViewport(int width, int height) {
    mOrthoMatrix.loadOrtho(0, width, height, 0, -1, 1);

Loading