Revert "Migrate SkImage::makeWithFilter to GrRecordingContext"
This reverts commit 7f0129d424a45f87653f6d0d83141e10fa96cba3.
Reason for revert: Broke Chrome roll
Original change's description:
> Migrate SkImage::makeWithFilter to GrRecordingContext
>
> The staging flag landed in Chrome CL 2307531.
>
> Bug: skia:104662
> Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
Change-Id: I280dbffa26da71d53872266e62fa3bcaa3c00989
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304802
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
diff --git a/bench/ImageFilterDAGBench.cpp b/bench/ImageFilterDAGBench.cpp
index 3f69c9d..1f3a3b2 100644
--- a/bench/ImageFilterDAGBench.cpp
+++ b/bench/ImageFilterDAGBench.cpp
@@ -73,9 +73,9 @@
SkIPoint offset = SkIPoint::Make(0, 0);
SkIRect discardSubset;
- auto dContext = GrAsDirectContext(canvas->recordingContext());
+ auto direct = GrAsDirectContext(canvas->recordingContext());
// makeWithFilter will only use the GPU backend if the image is already a texture
- sk_sp<SkImage> image = fImage->makeTextureImage(dContext);
+ sk_sp<SkImage> image = fImage->makeTextureImage(direct);
if (!image) {
image = fImage;
}
@@ -90,8 +90,8 @@
// But measure makeWithFilter() per loop since that's the focus of this benchmark
for (int j = 0; j < loops; j++) {
- image = image->makeWithFilter(dContext, mergeFilter.get(), subset, subset,
- &discardSubset, &offset);
+ image = image->makeWithFilter(mergeFilter.get(), subset, subset, &discardSubset,
+ &offset);
SkASSERT(image && image->dimensions() == fImage->dimensions());
}
}
diff --git a/docs/examples/Image_makeWithFilter.cpp b/docs/examples/Image_makeWithFilter.cpp
index 9ccba49..689b203 100644
--- a/docs/examples/Image_makeWithFilter.cpp
+++ b/docs/examples/Image_makeWithFilter.cpp
@@ -12,8 +12,8 @@
clipBounds.outset(60, 60);
SkIRect outSubset;
SkIPoint offset;
- sk_sp<SkImage> filtered(image->makeWithFilter(canvas->recordingContext(), offsetFilter.get(),
- subset, clipBounds, &outSubset, &offset));
+ sk_sp<SkImage> filtered(image->makeWithFilter(offsetFilter.get(), subset, clipBounds,
+ &outSubset, &offset));
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
diff --git a/gm/imagemakewithfilter.cpp b/gm/imagemakewithfilter.cpp
index 7108ac9..50046c4 100644
--- a/gm/imagemakewithfilter.cpp
+++ b/gm/imagemakewithfilter.cpp
@@ -271,20 +271,20 @@
// code paths (otherwise they may choose to do CPU filtering then upload)
sk_sp<SkImage> mainImage, auxImage;
- auto rContext = canvas->recordingContext();
- // In a DDL context, we can't use the GPU code paths and we will drop the work – skip.
- auto dContext = GrAsDirectContext(rContext);
- if (rContext) {
- if (!dContext) {
+ auto recording = canvas->recordingContext();
+ if (recording) {
+ // In a DDL context, we can't use the GPU code paths and we will drop the work – skip.
+ auto direct = GrAsDirectContext(recording);
+ if (!direct) {
*errorMsg = "Requires a direct context.";
return DrawResult::kSkip;
}
- if (dContext->abandoned()) {
+ if (direct->abandoned()) {
*errorMsg = "Direct context abandoned.";
return DrawResult::kSkip;
}
- mainImage = fMainImage->makeTextureImage(dContext);
- auxImage = fAuxImage->makeTextureImage(dContext);
+ mainImage = fMainImage->makeTextureImage(direct);
+ auxImage = fAuxImage->makeTextureImage(direct);
} else {
mainImage = fMainImage;
auxImage = fAuxImage;
@@ -292,8 +292,8 @@
if (!mainImage || !auxImage) {
return DrawResult::kFail;
}
- SkASSERT(mainImage && (mainImage->isTextureBacked() || !rContext));
- SkASSERT(auxImage && (auxImage->isTextureBacked() || !rContext));
+ SkASSERT(mainImage && (mainImage->isTextureBacked() || !recording));
+ SkASSERT(auxImage && (auxImage->isTextureBacked() || !recording));
SkScalar MARGIN = SkIntToScalar(40);
SkScalar DX = mainImage->width() + MARGIN;
@@ -376,9 +376,7 @@
SkIRect outSubset;
SkIPoint offset;
- auto rContext = canvas->recordingContext();
- result = mainImage->makeWithFilter(rContext, filter.get(), subset, clip,
- &outSubset, &offset);
+ result = mainImage->makeWithFilter(filter.get(), subset, clip, &outSubset, &offset);
SkASSERT(result);
SkASSERT(mainImage->isTextureBacked() == result->isTextureBacked());
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 161b0a2..8f21f73 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -1257,8 +1257,7 @@
is required storage for the actual bounds of the filtered SkImage. offset is
required storage for translation of returned SkImage.
- Returns nullptr if SkImage could not be created or if the recording context provided doesn't
- match the GPU context in which the image was created. If nullptr is returned, outSubset
+ Returns nullptr if SkImage could not be created. If nullptr is returned, outSubset
and offset are undefined.
Useful for animation of SkImageFilter that varies size from frame to frame.
@@ -1267,7 +1266,7 @@
of GPU texture returned. offset translates the returned SkImage to keep subsequent
animation frames aligned with respect to each other.
- @param context the GrRecordingContext in play - if it exists
+ @param context the GrContext in play - if it exists
@param filter how SkImage is sampled when transformed
@param subset bounds of SkImage processed by filter
@param clipBounds expected bounds of filtered SkImage
@@ -1275,16 +1274,16 @@
@param offset storage for returned SkImage translation
@return filtered SkImage, or nullptr
*/
- sk_sp<SkImage> makeWithFilter(GrRecordingContext* context,
+ sk_sp<SkImage> makeWithFilter(GrContext* context,
const SkImageFilter* filter, const SkIRect& subset,
const SkIRect& clipBounds, SkIRect* outSubset,
SkIPoint* offset) const;
-#ifdef SK_IMAGE_MAKE_WITH_FILTER_LEGACY_API
+ /** To be deprecated.
+ */
sk_sp<SkImage> makeWithFilter(const SkImageFilter* filter, const SkIRect& subset,
const SkIRect& clipBounds, SkIRect* outSubset,
SkIPoint* offset) const;
-#endif
/** Defines a callback function, taking one parameter of type GrBackendTexture with
no return value. Function is called when back-end texture is to be released.
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index a8f4c62..d2da072 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -359,24 +359,26 @@
std::move(colorSpace)));
}
-sk_sp<SkImage> SkImage::makeWithFilter(GrRecordingContext* rContext, const SkImageFilter* filter,
- const SkIRect& subset, const SkIRect& clipBounds,
- SkIRect* outSubset, SkIPoint* offset) const {
+sk_sp<SkImage> SkImage::makeWithFilter(const SkImageFilter* filter, const SkIRect& subset,
+ const SkIRect& clipBounds, SkIRect* outSubset,
+ SkIPoint* offset) const {
+ GrContext* context = as_IB(this)->context();
+ return this->makeWithFilter(context, filter, subset, clipBounds, outSubset, offset);
+}
+
+sk_sp<SkImage> SkImage::makeWithFilter(GrContext* grContext,
+ const SkImageFilter* filter, const SkIRect& subset,
+ const SkIRect& clipBounds, SkIRect* outSubset,
+ SkIPoint* offset) const {
if (!filter || !outSubset || !offset || !this->bounds().contains(subset)) {
return nullptr;
}
- sk_sp<SkSpecialImage> srcSpecialImage;
+ sk_sp<SkSpecialImage> srcSpecialImage =
#if SK_SUPPORT_GPU
- auto myContext = as_IB(this)->context();
- if (myContext && !myContext->priv().matches(rContext)) {
- return nullptr;
- }
- srcSpecialImage = SkSpecialImage::MakeFromImage(rContext, subset,
- sk_ref_sp(const_cast<SkImage*>(this)));
+ SkSpecialImage::MakeFromImage(grContext, subset, sk_ref_sp(const_cast<SkImage*>(this)));
#else
- srcSpecialImage = SkSpecialImage::MakeFromImage(nullptr, subset,
- sk_ref_sp(const_cast<SkImage*>(this)));
+ SkSpecialImage::MakeFromImage(nullptr, subset, sk_ref_sp(const_cast<SkImage*>(this)));
#endif
if (!srcSpecialImage) {
return nullptr;
@@ -421,15 +423,6 @@
return result->asImage();
}
-#ifdef SK_IMAGE_MAKE_WITH_FILTER_LEGACY_API
-sk_sp<SkImage> SkImage::makeWithFilter(const SkImageFilter* filter, const SkIRect& subset,
- const SkIRect& clipBounds, SkIRect* outSubset,
- SkIPoint* offset) const {
- return this->makeWithFilter(as_IB(this)->context(), filter, subset, clipBounds, outSubset,
- offset);
-}
-#endif
-
bool SkImage::isLazyGenerated() const {
return as_IB(this)->onIsLazyGenerated();
}
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 855604e..f8de5dc 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -329,10 +329,9 @@
return SkImageFilters::ColorFilter(std::move(filter), std::move(input), cropRect);
}
-static sk_sp<SkSpecialSurface> create_empty_special_surface(GrRecordingContext* rContext,
- int widthHeight) {
- if (rContext) {
- return SkSpecialSurface::MakeRenderTarget(rContext, widthHeight, widthHeight,
+static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, int widthHeight) {
+ if (context) {
+ return SkSpecialSurface::MakeRenderTarget(context, widthHeight, widthHeight,
GrColorType::kRGBA_8888, nullptr);
} else {
const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight,
@@ -341,18 +340,17 @@
}
}
-static sk_sp<SkSurface> create_surface(GrRecordingContext* rContext, int width, int height) {
+static sk_sp<SkSurface> create_surface(GrContext* context, int width, int height) {
const SkImageInfo info = SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType);
- if (rContext) {
- return SkSurface::MakeRenderTarget(rContext, SkBudgeted::kNo, info);
+ if (context) {
+ return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
} else {
return SkSurface::MakeRaster(info);
}
}
-static sk_sp<SkSpecialImage> create_empty_special_image(GrRecordingContext* rContext,
- int widthHeight) {
- sk_sp<SkSpecialSurface> surf(create_empty_special_surface(rContext, widthHeight));
+static sk_sp<SkSpecialImage> create_empty_special_image(GrContext* context, int widthHeight) {
+ sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, widthHeight));
SkASSERT(surf);
@@ -469,11 +467,11 @@
}
}
-static void test_cropRects(skiatest::Reporter* reporter, GrRecordingContext* rContext) {
+static void test_cropRects(skiatest::Reporter* reporter, GrContext* context) {
// Check that all filters offset to their absolute crop rect,
// unaffected by the input crop rect.
// Tests pass by not asserting.
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(rContext, 100));
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
SkASSERT(srcImg);
SkIRect inputCropRect = SkIRect::MakeXYWH(8, 13, 80, 80);
@@ -506,8 +504,7 @@
return img->readPixels(dst->pixmap(), src->subset().fLeft, src->subset().fTop);
}
-static void test_negative_blur_sigma(skiatest::Reporter* reporter,
- GrRecordingContext* rContext) {
+static void test_negative_blur_sigma(skiatest::Reporter* reporter, GrContext* context) {
// Check that SkBlurImageFilter will accept a negative sigma, either in
// the given arguments or after CTM application.
static const int kWidth = 32, kHeight = 32;
@@ -518,7 +515,7 @@
sk_sp<SkImage> gradient = SkImage::MakeFromBitmap(make_gradient_circle(kWidth, kHeight));
sk_sp<SkSpecialImage> imgSrc(
- SkSpecialImage::MakeFromImage(rContext, SkIRect::MakeWH(kWidth, kHeight), gradient));
+ SkSpecialImage::MakeFromImage(context, SkIRect::MakeWH(kWidth, kHeight), gradient));
SkIPoint offset;
SkImageFilter_Base::Context ctx(SkMatrix::I(), SkIRect::MakeWH(32, 32), nullptr,
@@ -667,13 +664,13 @@
test_morphology_radius_with_mirror_ctm(reporter, ctxInfo.directContext());
}
-static void test_zero_blur_sigma(skiatest::Reporter* reporter, GrRecordingContext* rContext) {
+static void test_zero_blur_sigma(skiatest::Reporter* reporter, GrContext* context) {
// Check that SkBlurImageFilter with a zero sigma and a non-zero srcOffset works correctly.
SkIRect cropRect = SkIRect::MakeXYWH(5, 0, 5, 10);
sk_sp<SkImageFilter> input(SkImageFilters::Offset(0, 0, nullptr, &cropRect));
sk_sp<SkImageFilter> filter(SkImageFilters::Blur(0, 0, std::move(input), &cropRect));
- sk_sp<SkSpecialSurface> surf(create_empty_special_surface(rContext, 10));
+ sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, 10));
surf->getCanvas()->clear(SK_ColorGREEN);
sk_sp<SkSpecialImage> image(surf->makeImageSnapshot());
@@ -712,10 +709,9 @@
// Tests that, even when an upstream filter has returned null (due to failure or clipping), a
// downstream filter that affects transparent black still does so even with a nullptr input.
-static void test_fail_affects_transparent_black(skiatest::Reporter* reporter,
- GrRecordingContext* rContext) {
+static void test_fail_affects_transparent_black(skiatest::Reporter* reporter, GrContext* context) {
sk_sp<FailImageFilter> failFilter(new FailImageFilter());
- sk_sp<SkSpecialImage> source(create_empty_special_image(rContext, 5));
+ sk_sp<SkSpecialImage> source(create_empty_special_image(context, 5));
SkImageFilter_Base::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 1, 1), nullptr,
kN32_SkColorType, nullptr, source.get());
sk_sp<SkColorFilter> green(SkColorFilters::Blend(SK_ColorGREEN, SkBlendMode::kSrc));
@@ -990,8 +986,7 @@
}
}
-static void test_imagefilter_merge_result_size(skiatest::Reporter* reporter,
- GrRecordingContext* rContext) {
+static void test_imagefilter_merge_result_size(skiatest::Reporter* reporter, GrContext* context) {
SkBitmap greenBM;
greenBM.allocN32Pixels(20, 20);
greenBM.eraseColor(SK_ColorGREEN);
@@ -999,7 +994,7 @@
sk_sp<SkImageFilter> source(SkImageFilters::Image(std::move(greenImage)));
sk_sp<SkImageFilter> merge(SkImageFilters::Merge(source, source));
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(rContext, 1));
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 1));
SkImageFilter_Base::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 100, 100), nullptr,
kN32_SkColorType, nullptr, srcImg.get());
@@ -1137,7 +1132,7 @@
canvas.restore();
}
-static void test_big_kernel(skiatest::Reporter* reporter, GrRecordingContext* rContext) {
+static void test_big_kernel(skiatest::Reporter* reporter, GrContext* context) {
// Check that a kernel that is too big for the GPU still works
SkScalar identityKernel[49] = {
0, 0, 0, 0, 0, 0, 0,
@@ -1156,7 +1151,7 @@
kernelSize, identityKernel, gain, bias, kernelOffset,
SkTileMode::kClamp, true, nullptr));
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(rContext, 100));
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
SkASSERT(srcImg);
SkIPoint offset;
@@ -1164,7 +1159,7 @@
kN32_SkColorType, nullptr, srcImg.get());
sk_sp<SkSpecialImage> resultImg(as_IFB(filter)->filterImage(ctx).imageAndOffset(&offset));
REPORTER_ASSERT(reporter, resultImg);
- REPORTER_ASSERT(reporter, SkToBool(rContext) == resultImg->isTextureBacked());
+ REPORTER_ASSERT(reporter, SkToBool(context) == resultImg->isTextureBacked());
REPORTER_ASSERT(reporter, resultImg->width() == 100 && resultImg->height() == 100);
REPORTER_ASSERT(reporter, offset.fX == 0 && offset.fY == 0);
}
@@ -1212,8 +1207,7 @@
canvas.drawPicture(recorder.finishRecordingAsPicture());
}
-static void test_clipped_picture_imagefilter(skiatest::Reporter* reporter,
- GrRecordingContext* rContext) {
+static void test_clipped_picture_imagefilter(skiatest::Reporter* reporter, GrContext* context) {
sk_sp<SkPicture> picture;
{
@@ -1228,7 +1222,7 @@
picture = recorder.finishRecordingAsPicture();
}
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(rContext, 2));
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 2));
sk_sp<SkImageFilter> imageFilter(SkImageFilters::Picture(picture));
@@ -1449,9 +1443,8 @@
test_xfermode_cropped_input(SkSurface::MakeRasterN32Premul(100, 100).get(), reporter);
}
-static void test_composed_imagefilter_offset(skiatest::Reporter* reporter,
- GrRecordingContext* rContext) {
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(rContext, 100));
+static void test_composed_imagefilter_offset(skiatest::Reporter* reporter, GrContext* context) {
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
SkIRect cropRect = SkIRect::MakeXYWH(1, 0, 20, 20);
sk_sp<SkImageFilter> offsetFilter(SkImageFilters::Offset(0, 0, nullptr, &cropRect));
@@ -1477,8 +1470,7 @@
test_composed_imagefilter_offset(reporter, ctxInfo.directContext());
}
-static void test_composed_imagefilter_bounds(skiatest::Reporter* reporter,
- GrRecordingContext* rContext) {
+static void test_composed_imagefilter_bounds(skiatest::Reporter* reporter, GrContext* context) {
// The bounds passed to the inner filter must be filtered by the outer
// filter, so that the inner filter produces the pixels that the outer
// filter requires as input. This matters if the outer filter moves pixels.
@@ -1496,7 +1488,7 @@
sk_sp<SkImageFilter> composedFilter(SkImageFilters::Compose(std::move(offsetFilter),
std::move(pictureFilter)));
- sk_sp<SkSpecialImage> sourceImage(create_empty_special_image(rContext, 100));
+ sk_sp<SkSpecialImage> sourceImage(create_empty_special_image(context, 100));
SkImageFilter_Base::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr,
kN32_SkColorType, nullptr, sourceImage.get());
SkIPoint offset;
@@ -1660,8 +1652,8 @@
test_large_blur_input(reporter, surface->getCanvas());
}
-static void test_make_with_filter(skiatest::Reporter* reporter, GrRecordingContext* rContext) {
- sk_sp<SkSurface> surface(create_surface(rContext, 192, 128));
+static void test_make_with_filter(skiatest::Reporter* reporter, GrContext* context) {
+ sk_sp<SkSurface> surface(create_surface(context, 192, 128));
surface->getCanvas()->clear(SK_ColorRED);
SkPaint bluePaint;
bluePaint.setColor(SK_ColorBLUE);
@@ -1675,39 +1667,31 @@
SkIPoint offset;
sk_sp<SkImage> result;
- result = sourceImage->makeWithFilter(rContext, nullptr, subset, clipBounds,
- &outSubset, &offset);
+ result = sourceImage->makeWithFilter(nullptr, subset, clipBounds, &outSubset, &offset);
REPORTER_ASSERT(reporter, !result);
- result = sourceImage->makeWithFilter(rContext, filter.get(), subset, clipBounds,
- nullptr, &offset);
+ result = sourceImage->makeWithFilter(filter.get(), subset, clipBounds, nullptr, &offset);
REPORTER_ASSERT(reporter, !result);
- result = sourceImage->makeWithFilter(rContext, filter.get(), subset, clipBounds,
- &outSubset, nullptr);
+ result = sourceImage->makeWithFilter(filter.get(), subset, clipBounds, &outSubset, nullptr);
REPORTER_ASSERT(reporter, !result);
SkIRect bigSubset = SkIRect::MakeXYWH(-10000, -10000, 20000, 20000);
- result = sourceImage->makeWithFilter(rContext, filter.get(), bigSubset, clipBounds,
- &outSubset, &offset);
+ result = sourceImage->makeWithFilter(filter.get(), bigSubset, clipBounds, &outSubset, &offset);
REPORTER_ASSERT(reporter, !result);
SkIRect empty = SkIRect::MakeEmpty();
- result = sourceImage->makeWithFilter(rContext, filter.get(), empty, clipBounds,
- &outSubset, &offset);
+ result = sourceImage->makeWithFilter(filter.get(), empty, clipBounds, &outSubset, &offset);
REPORTER_ASSERT(reporter, !result);
- result = sourceImage->makeWithFilter(rContext, filter.get(), subset, empty,
- &outSubset, &offset);
+ result = sourceImage->makeWithFilter(filter.get(), subset, empty, &outSubset, &offset);
REPORTER_ASSERT(reporter, !result);
SkIRect leftField = SkIRect::MakeXYWH(-1000, 0, 100, 100);
- result = sourceImage->makeWithFilter(rContext, filter.get(), subset, leftField,
- &outSubset, &offset);
+ result = sourceImage->makeWithFilter(filter.get(), subset, leftField, &outSubset, &offset);
REPORTER_ASSERT(reporter, !result);
- result = sourceImage->makeWithFilter(rContext, filter.get(), subset, clipBounds,
- &outSubset, &offset);
+ result = sourceImage->makeWithFilter(filter.get(), subset, clipBounds, &outSubset, &offset);
REPORTER_ASSERT(reporter, result);
REPORTER_ASSERT(reporter, result->bounds().contains(outSubset));
@@ -1722,8 +1706,7 @@
subset.setXYWH(0, 0, 160, 90);
filter = SkImageFilters::Xfermode(SkBlendMode::kSrc, nullptr);
- result = sourceImage->makeWithFilter(rContext, filter.get(), subset, clipBounds,
- &outSubset, &offset);
+ result = sourceImage->makeWithFilter(filter.get(), subset, clipBounds, &outSubset, &offset);
REPORTER_ASSERT(reporter, result);
}
}
diff --git a/tests/RepeatedClippedBlurTest.cpp b/tests/RepeatedClippedBlurTest.cpp
index 1161ce7..1db63be 100644
--- a/tests/RepeatedClippedBlurTest.cpp
+++ b/tests/RepeatedClippedBlurTest.cpp
@@ -23,13 +23,13 @@
// 2D canvas and compositor image filtering. In this case Chrome doesn't regularly purge
// the cache. This would result in Ganesh quickly running up to its max cache limit.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RepeatedClippedBlurTest, reporter, ctxInfo) {
- auto dContext = ctxInfo.directContext();
- GrResourceCache* cache = dContext->priv().getResourceCache();
+ auto context = ctxInfo.directContext();
+ GrResourceCache* cache = context->priv().getResourceCache();
const SkImageInfo ii = SkImageInfo::Make(1024, 600, kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
- sk_sp<SkSurface> dst(SkSurface::MakeRenderTarget(dContext, SkBudgeted::kNo, ii));
+ sk_sp<SkSurface> dst(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii));
if (!dst) {
ERRORF(reporter, "Could not create surfaces for repeated clipped blur test.");
return;
@@ -53,7 +53,7 @@
bm.eraseArea(SkIRect::MakeXYWH(1, 2, 1277, 1274), SK_ColorGREEN);
sk_sp<SkImage> rasterImg = SkImage::MakeFromBitmap(bm);
- bigImg = rasterImg->makeTextureImage(dContext);
+ bigImg = rasterImg->makeTextureImage(context);
}
sk_sp<SkImage> smImg;
@@ -63,7 +63,7 @@
SkImageInfo screenII = SkImageInfo::Make(1024, 600, kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
- sk_sp<SkSurface> s = SkSurface::MakeRenderTarget(dContext, SkBudgeted::kYes,
+ sk_sp<SkSurface> s = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes,
screenII, 1, kTopLeft_GrSurfaceOrigin,
nullptr);
SkCanvas* c = s->getCanvas();
@@ -74,7 +74,7 @@
}
// flush here just to clear the playing field
- dContext->flushAndSubmit();
+ context->flushAndSubmit();
size_t beforeBytes = cache->getResourceBytes();
@@ -93,7 +93,7 @@
SkIRect outSubset;
SkIPoint offset;
- sk_sp<SkImage> filteredImg = smImg->makeWithFilter(dContext, blur.get(), subset, clip,
+ sk_sp<SkImage> filteredImg = smImg->makeWithFilter(context, blur.get(), subset, clip,
&outSubset, &offset);
SkRect dstRect = SkRect::MakeXYWH(offset.fX, offset.fY,
@@ -101,7 +101,7 @@
dstCanvas->drawImageRect(filteredImg, outSubset, dstRect, nullptr);
// Flush here to mimic Chrome's SkiaHelper::ApplyImageFilter
- dContext->flushAndSubmit();
+ context->flushAndSubmit();
clip.fRight -= 16;
}