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

Commit e1e60bd0 authored by John Reck's avatar John Reck Committed by Automerger Merge Worker
Browse files

RESTRICT AUTOMERGE pixel-snap on HWUI side am: 38323c18

parents 128dd429 38323c18
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@
#include "VectorDrawable.h"
#include "pipeline/skia/AnimatedDrawables.h"
#include "pipeline/skia/FunctorDrawable.h"
#ifdef __ANDROID__
#include "renderthread/CanvasContext.h"
#endif

namespace android {
namespace uirenderer {
@@ -434,7 +437,19 @@ struct DrawPoints final : Op {
    size_t count;
    SkPaint paint;
    void draw(SkCanvas* c, const SkMatrix&) const {
        if (paint.isAntiAlias()) {
            c->drawPoints(mode, count, pod<SkPoint>(this), paint);
        } else {
            c->save();
#ifdef __ANDROID__
            auto pixelSnap = renderthread::CanvasContext::getActiveContext()->getPixelSnapMatrix();
            auto transform = c->getLocalToDevice();
            transform.postConcat(pixelSnap);
            c->setMatrix(transform);
#endif
            c->drawPoints(mode, count, pod<SkPoint>(this), paint);
            c->restore();
        }
    }
};
struct DrawVertices final : Op {
+8 −0
Original line number Diff line number Diff line
@@ -53,6 +53,14 @@ public:
    bool isSurfaceReady() override;
    bool isContextReady() override;

    const SkM44& getPixelSnapMatrix() const override {
        // Small (~1/16th) nudge to ensure that pixel-aligned non-AA'd draws fill the
        // desired fragment
        static const SkScalar kOffset = 0.063f;
        static const SkM44 sSnapMatrix = SkM44::Translate(kOffset, kOffset);
        return sSnapMatrix;
    }

    static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);

protected:
+4 −0
Original line number Diff line number Diff line
@@ -180,6 +180,10 @@ void SkiaVulkanPipeline::onContextDestroyed() {
    }
}

const SkM44& SkiaVulkanPipeline::getPixelSnapMatrix() const {
    return mVkSurface->getPixelSnapMatrix();
}

} /* namespace skiapipeline */
} /* namespace uirenderer */
} /* namespace android */
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public:
    void onStop() override;
    bool isSurfaceReady() override;
    bool isContextReady() override;
    const SkM44& getPixelSnapMatrix() const override;

    static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);
    static sk_sp<Bitmap> allocateHardwareBitmap(renderthread::RenderThread& thread,
+4 −0
Original line number Diff line number Diff line
@@ -793,6 +793,10 @@ SkISize CanvasContext::getNextFrameSize() const {
    return size;
}

const SkM44& CanvasContext::getPixelSnapMatrix() const {
    return mRenderPipeline->getPixelSnapMatrix();
}

void CanvasContext::prepareAndDraw(RenderNode* node) {
    ATRACE_CALL();

Loading