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

Commit c00972bb authored by Romain Guy's avatar Romain Guy
Browse files

Don't recreate a new texture every time we draw a layer.

Change-Id: I3c28aff5acffc7c6f1ac74805869725426c62d28
parent 425c305a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -387,7 +387,7 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
        return pointer != null ? pointer.yVelocity : 0;
    }
    
    private final Pointer getPointer(int id) {
    private Pointer getPointer(int id) {
        for (Pointer pointer = mPointerListHead; pointer != null; pointer = pointer.next) {
            if (pointer.id == id) {
                return pointer;
@@ -396,7 +396,7 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
        return null;
    }
    
    private static final Pointer obtainPointer() {
    private static Pointer obtainPointer() {
        synchronized (sPool) {
            if (sRecycledPointerCount != 0) {
                Pointer element = sRecycledPointerListHead;
@@ -409,7 +409,7 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
        return new Pointer();
    }
    
    private static final void releasePointer(Pointer pointer) {
    private static void releasePointer(Pointer pointer) {
        synchronized (sPool) {
            if (sRecycledPointerCount < POINTER_POOL_CAPACITY) {
                pointer.next = sRecycledPointerListHead;
@@ -419,7 +419,7 @@ public final class VelocityTracker implements Poolable<VelocityTracker> {
        }
    }
    
    private static final void releasePointerList(Pointer pointer) {
    private static void releasePointerList(Pointer pointer) {
        if (pointer != null) {
            synchronized (sPool) {
                int count = sRecycledPointerCount;
+8 −13
Original line number Diff line number Diff line
@@ -467,19 +467,14 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
        // Copy the framebuffer into the layer
        glBindTexture(GL_TEXTURE_2D, layer->texture);

        // TODO: Workaround for b/3054204
         if (layer->empty) {
             glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom,
                     layer->width, layer->height, 0);

        // TODO: Waiting for b/3054204 to be fixed
        // if (layer->empty) {
        //     glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom,
        //             layer->width, layer->height, 0);
        //     layer->empty = false;
        // } else {
        //     glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom,
        //             bounds.getWidth(), bounds.getHeight());
        //  }
             layer->empty = false;
         } else {
             glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left, mHeight - bounds.bottom,
                     bounds.getWidth(), bounds.getHeight());
          }

        // Enqueue the buffer coordinates to clear the corresponding region later
        mLayers.push(new Rect(bounds));