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

Commit 9b788773 authored by Stan Iliev's avatar Stan Iliev
Browse files

Disable blending for opaque TextureView

Opaque TextureView set by TextureView.setOpaque(true), should
draw with SRC blending, which in practice disables GL
blending.

Test: Ran Naver app, which is using opaque TextureView
Bug: 113845024
Change-Id: I5daa455a72b0ded50d6f9578f3b8a8701532f9d4
Merged-In: I5daa455a72b0ded50d6f9578f3b8a8701532f9d4
(cherry picked from commit 8fc3d8e0)
parent c3a74b5c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -72,5 +72,13 @@ void GlLayer::generateTexture() {
    }
}

SkBlendMode GlLayer::getMode() const {
    if (texture.blend || mode != SkBlendMode::kSrcOver) {
        return mode;
    } else {
        return SkBlendMode::kSrc;
    }
}

};  // namespace uirenderer
};  // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ public:
     */
    void onGlContextLost();

    SkBlendMode getMode() const override;

private:
    Caches& caches;

+2 −2
Original line number Diff line number Diff line
@@ -27,10 +27,10 @@ Layer::Layer(RenderState& renderState, Api api, sk_sp<SkColorFilter> colorFilter
             SkBlendMode mode)
        : GpuMemoryTracker(GpuObjectType::Layer)
        , mRenderState(renderState)
        , mode(mode)
        , mApi(api)
        , mColorFilter(colorFilter)
        , alpha(alpha)
        , mode(mode) {
        , alpha(alpha) {
    // TODO: This is a violation of Android's typical ref counting, but it
    // preserves the old inc/dec ref locations. This should be changed...
    incStrong(nullptr);
+6 −6
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ public:

    inline int getAlpha() const { return alpha; }

    inline SkBlendMode getMode() const { return mode; }
    virtual SkBlendMode getMode() const { return mode; }

    inline SkColorFilter* getColorFilter() const { return mColorFilter.get(); }

@@ -100,6 +100,11 @@ protected:

    RenderState& mRenderState;

    /**
     * Blending mode of the layer.
     */
    SkBlendMode mode;

private:
    void buildColorSpaceWithFilter();

@@ -130,11 +135,6 @@ private:
     */
    int alpha;

    /**
     * Blending mode of the layer.
     */
    SkBlendMode mode;

    /**
     * Optional texture coordinates transform.
     */