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

Commit 7628ab93 authored by Ram Indani's avatar Ram Indani Committed by Android (Google) Code Review
Browse files

Merge "Use the height as width when there is a rotation needs to be applied for the dst rect."

parents 21ad9031 98ccd61f
Loading
Loading
Loading
Loading
+50 −51
Original line number Diff line number Diff line
@@ -101,7 +101,6 @@ bool LayerDrawable::DrawLayer(GrRecordingContext* context,
        paint.setBlendMode(layer->getMode());
        paint.setColorFilter(layer->getColorFilter());
        const SkMatrix& totalMatrix = canvas->getTotalMatrix();
        if (srcRect || dstRect) {
        SkRect skiaSrcRect;
        if (srcRect && !srcRect->isEmpty()) {
            skiaSrcRect = *srcRect;
@@ -110,7 +109,9 @@ bool LayerDrawable::DrawLayer(GrRecordingContext* context,
        }
        SkRect skiaDestRect;
        if (dstRect && !dstRect->isEmpty()) {
                skiaDestRect = *dstRect;
            skiaDestRect = (windowTransform & NATIVE_WINDOW_TRANSFORM_ROT_90)
                                   ? SkRect::MakeIWH(dstRect->height(), dstRect->width())
                                   : SkRect::MakeIWH(dstRect->width(), dstRect->height());
        } else {
            skiaDestRect = (windowTransform & NATIVE_WINDOW_TRANSFORM_ROT_90)
                                   ? SkRect::MakeIWH(layerHeight, layerWidth)
@@ -145,15 +146,13 @@ bool LayerDrawable::DrawLayer(GrRecordingContext* context,
        // Skia TextureOp has the above logic build-in, but not NonAAFillRectOp. TextureOp works
        // only for SrcOver blending and without color filter (readback uses Src blending).
        SkSamplingOptions sampling(SkFilterMode::kNearest);
            if (layer->getForceFilter() ||
                shouldFilterRect(totalMatrix, skiaSrcRect, skiaDestRect)) {
        if (layer->getForceFilter() || shouldFilterRect(totalMatrix, skiaSrcRect, skiaDestRect)) {
            sampling = SkSamplingOptions(SkFilterMode::kLinear);
        }

        canvas->drawImageRect(layerImage.get(), skiaSrcRect, skiaDestRect, sampling, &paint,
                              constraint);
        canvas->restore();
        }
        // restore the original matrix
        if (useLayerTransform) {
            canvas->restore();