Remove usage of deprecated SkImage::makeWithFilter API call
Test: compiles and Skia images are generated correctly
SkImage::makeWithFilter has been deprecated and replaced with three
factory functions in the SkImages namespace in:
https://skia-review.googlesource.com/c/skia/+/749138
Bug: b/293326072
Bug: b/293475819
Change-Id: I13fc0fa7ac0acda0663b4b78e600bb60f771eb24
diff --git a/libs/hwui/pipeline/skia/BackdropFilterDrawable.cpp b/libs/hwui/pipeline/skia/BackdropFilterDrawable.cpp
index ffad699..e81cbfb 100644
--- a/libs/hwui/pipeline/skia/BackdropFilterDrawable.cpp
+++ b/libs/hwui/pipeline/skia/BackdropFilterDrawable.cpp
@@ -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 @@
}
auto imageSubset = mImageSubset.roundOut();
- backdropImage =
- backdropImage->makeWithFilter(canvas->recordingContext(), backdropFilter, imageSubset,
- imageSubset, &mOutSubset, &mOutOffset);
+#ifdef __ANDROID__
+ if (canvas->recordingContext()) {
+ backdropImage =
+ 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);
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
index 9d72c23..2b2e399 100644
--- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
+++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
@@ -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 @@
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(