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

Commit b16fa651 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "Added support for the GL_TEXTURE_EXTERNAL target" into gingerbread

parents 06a7cd44 0a91775c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ void Layer::onDraw(const Region& clip) const
        // if not everything below us is covered, we plug the holes!
        Region holes(clip.subtract(under));
        if (!holes.isEmpty()) {
            clearWithOpenGL(holes);
            clearWithOpenGL(holes, 0, 0, 0, 1);
        }
        return;
    }
+10 −34
Original line number Diff line number Diff line
@@ -324,16 +324,6 @@ void LayerBase::draw(const Region& inClip) const
    glEnable(GL_SCISSOR_TEST);

    onDraw(clip);

    /*
    glDisable(GL_TEXTURE_2D);
    glDisable(GL_DITHER);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
    glColor4x(0, 0x8000, 0, 0x10000);
    drawRegion(transparentRegionScreen);
    glDisable(GL_BLEND);
    */
}

void LayerBase::clearWithOpenGL(const Region& clip, GLclampf red,
@@ -343,7 +333,9 @@ void LayerBase::clearWithOpenGL(const Region& clip, GLclampf red,
    const DisplayHardware& hw(graphicPlane(0).displayHardware());
    const uint32_t fbHeight = hw.getHeight();
    glColor4f(red,green,blue,alpha);
    glDisable(GL_TEXTURE_2D);

    TextureManager::deactivateTextures();

    glDisable(GL_BLEND);
    glDisable(GL_DITHER);

@@ -371,12 +363,10 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
    const State& s(drawingState());
    
    // bind our texture
    validateTexture(texture.name);
    TextureManager::activateTexture(texture, needsFiltering());
    uint32_t width  = texture.width; 
    uint32_t height = texture.height;

    glEnable(GL_TEXTURE_2D);

    GLenum src = mPremultipliedAlpha ? GL_ONE : GL_SRC_ALPHA;
    if (UNLIKELY(s.alpha < 0xFF)) {
        const GLfloat alpha = s.alpha * (1.0f/255.0f);
@@ -431,6 +421,12 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
        glScalef(texture.wScale, texture.hScale, 1.0f);
    }

    if (needsDithering()) {
        glEnable(GL_DITHER);
    } else {
        glDisable(GL_DITHER);
    }

    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glVertexPointer(2, GL_FLOAT, 0, mVertices);
    glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
@@ -444,26 +440,6 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}

void LayerBase::validateTexture(GLint textureName) const
{
    glBindTexture(GL_TEXTURE_2D, textureName);
    // TODO: reload the texture if needed
    // this is currently done in loadTexture() below
    if (needsFiltering()) {
        glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    } else {
        glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    }

    if (needsDithering()) {
        glEnable(GL_DITHER);
    } else {
        glDisable(GL_DITHER);
    }
}

void LayerBase::dump(String8& result, char* buffer, size_t SIZE) const
{
    const Layer::State& s(drawingState());
+0 −1
Original line number Diff line number Diff line
@@ -260,7 +260,6 @@ protected:

private:
    LayerBase(const LayerBase& rhs);
    void validateTexture(GLint textureName) const;
};


+3 −0
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@ void LayerBlur::onDraw(const Region& clip) const
    Region::const_iterator it = clip.begin();
    Region::const_iterator const end = clip.end();
    if (it != end) {
#if defined(GL_OES_texture_external)
        glDisable(GL_TEXTURE_EXTERNAL_OES);
#endif
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, mTextureName);

+3 −0
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@ void LayerDim::onDraw(const Region& clip) const
        glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
        glColor4x(0, 0, 0, alpha);
        
#if defined(GL_OES_texture_external)
        glDisable(GL_TEXTURE_EXTERNAL_OES);
#endif
#if defined(DIM_WITH_TEXTURE) && defined(EGL_ANDROID_image_native_buffer)
        if (sUseTexture) {
            glBindTexture(GL_TEXTURE_2D, sTexId);
Loading