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

Commit ee6eeb39 authored by jiayongqiang's avatar jiayongqiang Committed by Alec Mouri
Browse files

Provide a default pixel snap matrix if Surface has been destroyed when


executing buildLayer.

If run buildLayer but the Surface has been destroyed, the nullptr
issue will occure from `SkiaVulkanPipeline::getPixelSnapMatrix()`.

Bug: 406206414
Flag: EXEMPT trivial bug fix
Signed-off-by: default avatarjiayongqiang <jiayongqiang@xiaomi.com>
(cherry picked from https://android-review.googlesource.com/q/commit:e417f924f34c53193d982e91fdbd1898a2257ed6)
Merged-In: I8ec98e544686ff57e55d9c37ad08b9e5f62ea74e
Change-Id: I8ec98e544686ff57e55d9c37ad08b9e5f62ea74e
parent 29f2ae3c
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -214,8 +214,12 @@ void SkiaVulkanPipeline::onContextDestroyed() {
}
}


const SkM44& SkiaVulkanPipeline::getPixelSnapMatrix() const {
const SkM44& SkiaVulkanPipeline::getPixelSnapMatrix() const {
    if (mVkSurface) {
        return mVkSurface->getPixelSnapMatrix();
        return mVkSurface->getPixelSnapMatrix();
    }
    }
    static const SkM44 sSnapMatrix = VulkanSurface::GetPixelSnapMatrix(SkISize::MakeEmpty(), 0);
    return sSnapMatrix;
}


} /* namespace skiapipeline */
} /* namespace skiapipeline */
} /* namespace uirenderer */
} /* namespace uirenderer */
+1 −1
Original line number Original line Diff line number Diff line
@@ -65,7 +65,7 @@ static SkMatrix GetPreTransformMatrix(SkISize windowSize, int transform) {
    return SkMatrix::I();
    return SkMatrix::I();
}
}


static SkM44 GetPixelSnapMatrix(SkISize windowSize, int transform) {
SkM44 VulkanSurface::GetPixelSnapMatrix(SkISize windowSize, int transform) {
    // Small (~1/16th) nudge to ensure that pixel-aligned non-AA'd draws fill the
    // Small (~1/16th) nudge to ensure that pixel-aligned non-AA'd draws fill the
    // desired fragment
    // desired fragment
    static const SkScalar kOffset = 0.063f;
    static const SkScalar kOffset = 0.063f;
+1 −0
Original line number Original line Diff line number Diff line
@@ -48,6 +48,7 @@ public:


    void setColorSpace(sk_sp<SkColorSpace> colorSpace);
    void setColorSpace(sk_sp<SkColorSpace> colorSpace);
    const SkM44& getPixelSnapMatrix() const { return mWindowInfo.pixelSnapMatrix; }
    const SkM44& getPixelSnapMatrix() const { return mWindowInfo.pixelSnapMatrix; }
    static SkM44 GetPixelSnapMatrix(SkISize windowSize, int transform);


private:
private:
    /*
    /*