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

Commit 9df09ccf authored by bsears's avatar bsears
Browse files

Revert "Added crop rect to LayerDrawable to not crop TextureView..."

Revert "Adds out parameters for crop rectangle and transform"

Revert "Add test to crop TextureView and verify if outer edge ha..."

Revert submission 15339442-1texelcrop

Reason for revert: Bisection identified these CLs as the likely cause of Droidfood blocking bugs b/195620803 and b/195637414

Bug: 195637414
Bug: 195620803

Reverted Changes:
If1f448a94:Added crop rect to LayerDrawable to not crop Textu...
Iefde6bdf7:Add test to crop TextureView and verify if outer e...
Icf0ee20e8:Adds out parameters for crop rectangle and transfo...

Change-Id: I3448ebe193f25de79d186ae705911d99da2cef2b
parent ef54c038
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
// TODO: Use public SurfaceTexture APIs once available and include public NDK header file instead.
#include <surfacetexture/surface_texture_platform.h>
#include "AutoBackendTextureRelease.h"
#include "Matrix.h"
#include "Properties.h"
#include "renderstate/RenderState.h"
#include "renderthread/EglManager.h"
@@ -144,17 +145,16 @@ void DeferredLayerUpdater::apply() {
        }
        if (mUpdateTexImage) {
            mUpdateTexImage = false;
            float transformMatrix[16];
            android_dataspace dataspace;
            int slot;
            bool newContent = false;
            ARect rect;
            uint32_t textureTransform;
            // Note: ASurfaceTexture_dequeueBuffer discards all but the last frame. This
            // is necessary if the SurfaceTexture queue is in synchronous mode, and we
            // cannot tell which mode it is in.
            AHardwareBuffer* hardwareBuffer = ASurfaceTexture_dequeueBuffer(
                    mSurfaceTexture.get(), &slot, &dataspace, &newContent, createReleaseFence,
                    fenceWait, this, &rect, &textureTransform);
                    mSurfaceTexture.get(), &slot, &dataspace, transformMatrix, &newContent,
                    createReleaseFence, fenceWait, this);

            if (hardwareBuffer) {
                mCurrentSlot = slot;
@@ -165,12 +165,12 @@ void DeferredLayerUpdater::apply() {
                // (invoked by createIfNeeded) will add a ref to the AHardwareBuffer.
                AHardwareBuffer_release(hardwareBuffer);
                if (layerImage.get()) {
                    SkMatrix textureTransform;
                    mat4(transformMatrix).copyTo(textureTransform);
                    // force filtration if buffer size != layer size
                    bool forceFilter =
                            mWidth != layerImage->width() || mHeight != layerImage->height();
                    SkRect cropRect =
                            SkRect::MakeLTRB(rect.left, rect.top, rect.right, rect.bottom);
                    updateLayer(forceFilter, textureTransform, cropRect, layerImage);
                    updateLayer(forceFilter, textureTransform, layerImage);
                }
            }
        }
@@ -182,13 +182,12 @@ void DeferredLayerUpdater::apply() {
    }
}

void DeferredLayerUpdater::updateLayer(bool forceFilter, const uint32_t textureTransform,
                                       const SkRect cropRect, const sk_sp<SkImage>& layerImage) {
void DeferredLayerUpdater::updateLayer(bool forceFilter, const SkMatrix& textureTransform,
                                       const sk_sp<SkImage>& layerImage) {
    mLayer->setBlend(mBlend);
    mLayer->setForceFilter(forceFilter);
    mLayer->setSize(mWidth, mHeight);
    mLayer->setTextureTransform(textureTransform);
    mLayer->setCropRect(cropRect);
    mLayer->getTexTransform() = textureTransform;
    mLayer->setImage(layerImage);
}

+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ public:

    void detachSurfaceTexture();

    void updateLayer(bool forceFilter, const uint32_t textureTransform, const SkRect cropRect,
    void updateLayer(bool forceFilter, const SkMatrix& textureTransform,
                     const sk_sp<SkImage>& layerImage);

    void destroyLayer();
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ Layer::Layer(RenderState& renderState, sk_sp<SkColorFilter> colorFilter, int alp
    // preserves the old inc/dec ref locations. This should be changed...
    incStrong(nullptr);
    renderState.registerLayer(this);
    texTransform.setIdentity();
    transform.setIdentity();
}

@@ -100,6 +101,7 @@ void Layer::draw(SkCanvas* canvas) {
    const int layerHeight = getHeight();
    if (layerImage) {
        SkMatrix textureMatrixInv;
        textureMatrixInv = getTexTransform();
        // TODO: after skia bug https://bugs.chromium.org/p/skia/issues/detail?id=7075 is fixed
        // use bottom left origin and remove flipV and invert transformations.
        SkMatrix flipV;
+6 −19
Original line number Diff line number Diff line
@@ -74,17 +74,9 @@ public:

    void setColorFilter(sk_sp<SkColorFilter> filter) { mColorFilter = filter; };

    inline SkMatrix& getTransform() { return transform; }

    inline SkRect getCropRect() { return mCropRect; }
    inline SkMatrix& getTexTransform() { return texTransform; }

    inline void setCropRect(const SkRect cropRect) { mCropRect = cropRect; }

    inline void setTextureTransform(uint32_t textureTransform) {
        mTextureTransform = textureTransform;
    }

    inline uint32_t getTextureTransform() { return mTextureTransform; }
    inline SkMatrix& getTransform() { return transform; }

    /**
     * Posts a decStrong call to the appropriate thread.
@@ -124,19 +116,14 @@ private:
    SkBlendMode mode;

    /**
     * Optional transform.
     * Optional texture coordinates transform.
     */
    SkMatrix transform;

    /**
     * Optional crop
     */
    SkRect mCropRect;
    SkMatrix texTransform;

    /**
     * Optional transform
     * Optional transform.
     */
    uint32_t mTextureTransform;
    SkMatrix transform;

    /**
     * An image backing the layer.
+5 −0
Original line number Diff line number Diff line
@@ -251,6 +251,8 @@ CopyResult Readback::copyHWBitmapInto(Bitmap* hwBitmap, SkBitmap* bitmap) {

    Rect srcRect;
    Matrix4 transform;
    transform.loadScale(1, -1, 1);
    transform.translate(0, -1);

    return copyImageInto(hwBitmap->makeImage(), transform, srcRect, bitmap);
}
@@ -278,6 +280,8 @@ CopyResult Readback::copyLayerInto(DeferredLayerUpdater* deferredLayer, SkBitmap
CopyResult Readback::copyImageInto(const sk_sp<SkImage>& image, SkBitmap* bitmap) {
    Rect srcRect;
    Matrix4 transform;
    transform.loadScale(1, -1, 1);
    transform.translate(0, -1);
    return copyImageInto(image, transform, srcRect, bitmap);
}

@@ -316,6 +320,7 @@ CopyResult Readback::copyImageInto(const sk_sp<SkImage>& image, Matrix4& texTran

    Layer layer(mRenderThread.renderState(), nullptr, 255, SkBlendMode::kSrc);
    layer.setSize(displayedWidth, displayedHeight);
    texTransform.copyTo(layer.getTexTransform());
    layer.setImage(image);
    // Scaling filter is not explicitly set here, because it is done inside copyLayerInfo
    // after checking the necessity based on the src/dest rect size and the transformation.
Loading