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

Commit 33f8142f authored by Robert Phillips's avatar Robert Phillips Committed by Android (Google) Code Review
Browse files

Merge "Remove usage of deprecated SkImage::makeWithFilter API call" into main

parents 57255853 74fe4712
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -28,16 +28,20 @@
#include "DamageAccumulator.h"
#include "pipeline/skia/SkiaDisplayList.h"
#endif
#include <SkPathOps.h>
#include <gui/TraceUtils.h>
#include "utils/MathUtils.h"
#include "utils/StringUtils.h"
#include <ui/FatVector.h>

#include <SkPathOps.h>
#include <algorithm>
#include <atomic>
#include <sstream>
#include <string>
#include <ui/FatVector.h>

#ifdef __ANDROID__
#include "include/gpu/ganesh/SkImageGanesh.h"
#endif
#include "utils/MathUtils.h"
#include "utils/StringUtils.h"

namespace android {
namespace uirenderer {
@@ -370,13 +374,18 @@ std::optional<RenderNode::SnapshotResult> RenderNode::updateSnapshotIfRequired(
               mImageFilterClipBounds != clipBounds ||
               mTargetImageFilterLayerSurfaceGenerationId != layerSurfaceGenerationId) {
        // Otherwise create a new snapshot with the given filter and snapshot
        mSnapshotResult.snapshot =
                snapshot->makeWithFilter(context,
                                         imageFilter,
                                         subset,
                                         clipBounds,
                                         &mSnapshotResult.outSubset,
#ifdef __ANDROID__
        if (context) {
            mSnapshotResult.snapshot = SkImages::MakeWithFilter(
                    context, snapshot, imageFilter, subset, clipBounds, &mSnapshotResult.outSubset,
                    &mSnapshotResult.outOffset);
        } else
#endif
        {
            mSnapshotResult.snapshot = SkImages::MakeWithFilter(
                    snapshot, imageFilter, subset, clipBounds, &mSnapshotResult.outSubset,
                    &mSnapshotResult.outOffset);
        }
        mTargetImageFilter = sk_ref_sp(imageFilter);
        mImageFilterClipBounds = clipBounds;
        mTargetImageFilterLayerSurfaceGenerationId = layerSurfaceGenerationId;
+14 −3
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@

#include "RenderNode.h"
#include "RenderNodeDrawable.h"
#ifdef __ANDROID__
#include "include/gpu/ganesh/SkImageGanesh.h"
#endif

namespace android {
namespace uirenderer {
@@ -72,9 +75,17 @@ void BackdropFilterDrawable::onDraw(SkCanvas* canvas) {
    }

    auto imageSubset = mImageSubset.roundOut();
#ifdef __ANDROID__
    if (canvas->recordingContext()) {
        backdropImage =
            backdropImage->makeWithFilter(canvas->recordingContext(), backdropFilter, imageSubset,
                SkImages::MakeWithFilter(canvas->recordingContext(), backdropImage, backdropFilter,
                                         imageSubset, imageSubset, &mOutSubset, &mOutOffset);
    } else
#endif
    {
        backdropImage = SkImages::MakeWithFilter(backdropImage, backdropFilter, imageSubset,
                                                 imageSubset, &mOutSubset, &mOutOffset);
    }
    canvas->drawImageRect(backdropImage, SkRect::Make(mOutSubset), mDstBounds,
                          SkSamplingOptions(SkFilterMode::kLinear), &mPaint,
                          SkCanvas::kStrict_SrcRectConstraint);
+21 −7
Original line number Diff line number Diff line
@@ -15,21 +15,25 @@
 */

#include "RenderNodeDrawable.h"

#include <SkPaint.h>
#include <SkPaintFilterCanvas.h>
#include <SkPoint.h>
#include <SkRRect.h>
#include <SkRect.h>
#include <gui/TraceUtils.h>
#include <include/effects/SkImageFilters.h>
#ifdef __ANDROID__
#include <include/gpu/ganesh/SkImageGanesh.h>
#endif

#include <optional>

#include "RenderNode.h"
#include "SkiaDisplayList.h"
#include "StretchMask.h"
#include "TransformCanvas.h"

#include <include/effects/SkImageFilters.h>

#include <optional>

namespace android {
namespace uirenderer {
namespace skiapipeline {
@@ -255,9 +259,19 @@ void RenderNodeDrawable::drawContent(SkCanvas* canvas) const {
                snapshotImage = renderNode->getLayerSurface()->makeImageSnapshot();
                if (imageFilter) {
                    auto subset = SkIRect::MakeWH(srcBounds.width(), srcBounds.height());
                    snapshotImage = snapshotImage->makeWithFilter(recordingContext, imageFilter,
                                                                  subset, clipBounds.roundOut(),
                                                                  &srcBounds, &offset);

#ifdef __ANDROID__
                    if (recordingContext) {
                        snapshotImage = SkImages::MakeWithFilter(
                                recordingContext, snapshotImage, imageFilter, subset,
                                clipBounds.roundOut(), &srcBounds, &offset);
                    } else
#endif
                    {
                        snapshotImage = SkImages::MakeWithFilter(snapshotImage, imageFilter, subset,
                                                                 clipBounds.roundOut(), &srcBounds,
                                                                 &offset);
                    }
                }
            } else {
                const auto snapshotResult = renderNode->updateSnapshotIfRequired(