Begin removing deprecated (and now, unused) ImageFilter code paths
This CL focuses on removing the Proxy objects but takes some other stuff with it.
BUG=skia:4965
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1896383003
Review URL: https://codereview.chromium.org/1896383003
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 688069e..40c805a 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -138,11 +138,11 @@
const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize);
- sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromRaster(nullptr, full, srcBM));
+ sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromRaster(full, srcBM));
const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
- sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromRaster(nullptr, subset, srcBM));
+ sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromRaster(subset, srcBM));
test_find_existing(reporter, fullImg, subsetImg);
test_dont_find_if_diff_key(reporter, fullImg, subsetImg);
@@ -155,11 +155,11 @@
static void test_image_backed(skiatest::Reporter* reporter, const sk_sp<SkImage>& srcImage) {
const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize);
- sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromImage(nullptr, full, srcImage));
+ sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromImage(full, srcImage));
const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
- sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromImage(nullptr, subset, srcImage));
+ sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromImage(subset, srcImage));
test_find_existing(reporter, fullImg, subsetImg);
test_dont_find_if_diff_key(reporter, fullImg, subsetImg);
@@ -220,13 +220,13 @@
const SkIRect& full = SkIRect::MakeWH(kFullSize, kFullSize);
- sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(nullptr, full,
+ sk_sp<SkSpecialImage> fullImg(SkSpecialImage::MakeFromGpu(full,
kNeedNewImageUniqueID_SpecialImage,
srcTexture));
const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
- sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(nullptr, subset,
+ sk_sp<SkSpecialImage> subsetImg(SkSpecialImage::MakeFromGpu(subset,
kNeedNewImageUniqueID_SpecialImage,
srcTexture));
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index e22d636..4db9196 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -6,7 +6,6 @@
*/
#include "SkBitmap.h"
-#include "SkBitmapDevice.h"
#include "SkBlurImageFilter.h"
#include "SkCanvas.h"
#include "SkColorFilterImageFilter.h"
@@ -38,11 +37,9 @@
#include "SkTileImageFilter.h"
#include "SkXfermodeImageFilter.h"
#include "Test.h"
-#include "TestingSpecialImageAccess.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "SkGpuDevice.h"
#endif
static const int kBitmapSize = 4;
@@ -370,27 +367,23 @@
return SkColorFilterImageFilter::Make(std::move(filter), std::move(input), cropRect);
}
-static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context,
- SkImageFilter::Proxy* proxy,
- int widthHeight) {
+static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, int widthHeight) {
if (context) {
GrSurfaceDesc desc;
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = widthHeight;
desc.fHeight = widthHeight;
- return SkSpecialSurface::MakeRenderTarget(proxy, context, desc);
+ return SkSpecialSurface::MakeRenderTarget(context, desc);
} else {
const SkImageInfo info = SkImageInfo::MakeN32(widthHeight, widthHeight,
kOpaque_SkAlphaType);
- return SkSpecialSurface::MakeRaster(proxy, info);
+ return SkSpecialSurface::MakeRaster(info);
}
}
-static sk_sp<SkSpecialImage> create_empty_special_image(GrContext* context,
- SkImageFilter::Proxy* proxy,
- int widthHeight) {
- sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, proxy, 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);
@@ -521,13 +514,12 @@
}
}
-static void test_crop_rects(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
+static void test_crop_rects(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(context, proxy, 100));
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
SkASSERT(srcImg);
SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80));
@@ -546,8 +538,7 @@
}
}
-static void test_negative_blur_sigma(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
+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.
@@ -558,8 +549,7 @@
sk_sp<SkImageFilter> negativeFilter(SkBlurImageFilter::Make(-five, five, nullptr));
SkBitmap gradient = make_gradient_circle(width, height);
- sk_sp<SkSpecialImage> imgSrc(SkSpecialImage::MakeFromRaster(proxy,
- SkIRect::MakeWH(width, height),
+ sk_sp<SkSpecialImage> imgSrc(SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(width, height),
gradient));
SkIPoint offset;
@@ -623,62 +613,23 @@
}
}
-typedef void (*PFTest)(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context);
-
-static void run_raster_test(skiatest::Reporter* reporter,
- int widthHeight,
- PFTest test) {
- const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
-
- const SkImageInfo info = SkImageInfo::MakeN32Premul(widthHeight, widthHeight);
-
- sk_sp<SkBaseDevice> device(SkBitmapDevice::Create(info, props));
- SkImageFilter::DeviceProxy proxy(device.get());
-
- (*test)(&proxy, reporter, nullptr);
-}
-
-#if SK_SUPPORT_GPU
-static void run_gpu_test(skiatest::Reporter* reporter,
- GrContext* context,
- int widthHeight,
- PFTest test) {
- const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
-
- sk_sp<SkGpuDevice> device(SkGpuDevice::Create(context,
- SkBudgeted::kNo,
- SkImageInfo::MakeN32Premul(widthHeight,
- widthHeight),
- 0,
- &props,
- SkGpuDevice::kUninit_InitContents));
- SkImageFilter::DeviceProxy proxy(device.get());
-
- (*test)(&proxy, reporter, context);
-}
-#endif
-
DEF_TEST(ImageFilterNegativeBlurSigma, reporter) {
- run_raster_test(reporter, 100, test_negative_blur_sigma);
+ test_negative_blur_sigma(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_negative_blur_sigma);
+ test_negative_blur_sigma(reporter, ctxInfo.fGrContext);
}
#endif
-static void test_zero_blur_sigma(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context) {
+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.
SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(5, 0, 5, 10)));
sk_sp<SkImageFilter> input(SkOffsetImageFilter::Make(0, 0, nullptr, &cropRect));
sk_sp<SkImageFilter> filter(SkBlurImageFilter::Make(0, 0, std::move(input), &cropRect));
- sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, proxy, 10));
+ sk_sp<SkSpecialSurface> surf(create_empty_special_surface(context, 10));
surf->getCanvas()->clear(SK_ColorGREEN);
sk_sp<SkSpecialImage> image(surf->makeImageSnapshot());
@@ -707,23 +658,21 @@
}
DEF_TEST(ImageFilterZeroBlurSigma, reporter) {
- run_raster_test(reporter, 100, test_zero_blur_sigma);
+ test_zero_blur_sigma(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_zero_blur_sigma);
+ test_zero_blur_sigma(reporter, ctxInfo.fGrContext);
}
#endif
// 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(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context) {
+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(context, proxy, 5));
+ sk_sp<SkSpecialImage> source(create_empty_special_image(context, 5));
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 1, 1), nullptr);
sk_sp<SkColorFilter> green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode));
SkASSERT(green->affectsTransparentBlack());
@@ -741,12 +690,12 @@
}
DEF_TEST(ImageFilterFailAffectsTransparentBlack, reporter) {
- run_raster_test(reporter, 100, test_fail_affects_transparent_black);
+ test_fail_affects_transparent_black(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_fail_affects_transparent_black);
+ test_fail_affects_transparent_black(reporter, ctxInfo.fGrContext);
}
#endif
@@ -935,9 +884,7 @@
}
}
-static void test_imagefilter_merge_result_size(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context) {
+static void test_imagefilter_merge_result_size(skiatest::Reporter* reporter, GrContext* context) {
SkBitmap greenBM;
greenBM.allocN32Pixels(20, 20);
greenBM.eraseColor(SK_ColorGREEN);
@@ -945,7 +892,7 @@
sk_sp<SkImageFilter> source(SkImageSource::Make(std::move(greenImage)));
sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(source, source));
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 1));
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 1));
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 100, 100), nullptr);
SkIPoint offset;
@@ -957,12 +904,12 @@
}
DEF_TEST(ImageFilterMergeResultSize, reporter) {
- run_raster_test(reporter, 100, test_imagefilter_merge_result_size);
+ test_imagefilter_merge_result_size(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_imagefilter_merge_result_size);
+ test_imagefilter_merge_result_size(reporter, ctxInfo.fGrContext);
}
#endif
@@ -1092,9 +1039,7 @@
canvas.restore();
}
-static void test_big_kernel(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context) {
+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,
@@ -1114,7 +1059,7 @@
SkMatrixConvolutionImageFilter::kClamp_TileMode,
true, nullptr));
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100));
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
SkASSERT(srcImg);
SkIPoint offset;
@@ -1127,23 +1072,23 @@
}
DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) {
- run_raster_test(reporter, 100, test_big_kernel);
+ test_big_kernel(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_big_kernel);
+ test_big_kernel(reporter, ctxInfo.fGrContext);
}
#endif
DEF_TEST(ImageFilterCropRect, reporter) {
- run_raster_test(reporter, 100, test_crop_rects);
+ test_crop_rects(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_crop_rects);
+ test_crop_rects(reporter, ctxInfo.fGrContext);
}
#endif
@@ -1232,9 +1177,7 @@
? pixel != SK_ColorGREEN : pixel == SK_ColorGREEN);
}
-static void test_clipped_picture_imagefilter(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context) {
+static void test_clipped_picture_imagefilter(skiatest::Reporter* reporter, GrContext* context) {
sk_sp<SkPicture> picture;
{
@@ -1249,7 +1192,7 @@
picture = recorder.finishRecordingAsPicture();
}
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 2));
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 2));
sk_sp<SkImageFilter> imageFilter(SkPictureImageFilter::Make(picture));
@@ -1261,12 +1204,12 @@
}
DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) {
- run_raster_test(reporter, 2, test_clipped_picture_imagefilter);
+ test_clipped_picture_imagefilter(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 2, test_clipped_picture_imagefilter);
+ test_clipped_picture_imagefilter(reporter, ctxInfo.fGrContext);
}
#endif
@@ -1500,10 +1443,8 @@
test_xfermode_cropped_input(&canvas, reporter);
}
-static void test_composed_imagefilter_offset(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context) {
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100));
+static void test_composed_imagefilter_offset(skiatest::Reporter* reporter, GrContext* context) {
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20));
sk_sp<SkImageFilter> offsetFilter(SkOffsetImageFilter::Make(0, 0, nullptr, &cropRect));
@@ -1520,18 +1461,16 @@
}
DEF_TEST(ComposedImageFilterOffset, reporter) {
- run_raster_test(reporter, 100, test_composed_imagefilter_offset);
+ test_composed_imagefilter_offset(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_composed_imagefilter_offset);
+ test_composed_imagefilter_offset(reporter, ctxInfo.fGrContext);
}
#endif
-static void test_composed_imagefilter_bounds(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context) {
+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.
@@ -1549,7 +1488,7 @@
sk_sp<SkImageFilter> composedFilter(SkComposeImageFilter::Make(std::move(offsetFilter),
std::move(pictureFilter)));
- sk_sp<SkSpecialImage> sourceImage(create_empty_special_image(context, proxy, 100));
+ sk_sp<SkSpecialImage> sourceImage(create_empty_special_image(context, 100));
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr);
SkIPoint offset;
sk_sp<SkSpecialImage> result(composedFilter->filterImage(sourceImage.get(), ctx, &offset));
@@ -1564,19 +1503,17 @@
}
DEF_TEST(ComposedImageFilterBounds, reporter) {
- run_raster_test(reporter, 100, test_composed_imagefilter_bounds);
+ test_composed_imagefilter_bounds(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_composed_imagefilter_bounds);
+ test_composed_imagefilter_bounds(reporter, ctxInfo.fGrContext);
}
#endif
-static void test_partial_crop_rect(SkImageFilter::Proxy* proxy,
- skiatest::Reporter* reporter,
- GrContext* context) {
- sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100));
+static void test_partial_crop_rect(skiatest::Reporter* reporter, GrContext* context) {
+ sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 100));
SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30),
SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::kHasHeight_CropEdge);
@@ -1594,12 +1531,12 @@
}
DEF_TEST(ImageFilterPartialCropRect, reporter) {
- run_raster_test(reporter, 100, test_partial_crop_rect);
+ test_partial_crop_rect(reporter, nullptr);
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterPartialCropRect_Gpu, reporter, ctxInfo) {
- run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_partial_crop_rect);
+ test_partial_crop_rect(reporter, ctxInfo.fGrContext);
}
#endif
@@ -1740,31 +1677,27 @@
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) {
- const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
- sk_sp<SkGpuDevice> device(SkGpuDevice::Create(ctxInfo.fGrContext,
- SkBudgeted::kNo,
- SkImageInfo::MakeN32Premul(100, 100),
- 0,
- &props,
- SkGpuDevice::kUninit_InitContents));
- SkCanvas canvas(device.get());
+ sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext,
+ SkBudgeted::kNo,
+ SkImageInfo::MakeN32Premul(100, 100)));
- test_huge_blur(&canvas, reporter);
+
+ SkCanvas* canvas = surf->getCanvas();
+
+ test_huge_blur(canvas, reporter);
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, ctxInfo) {
- const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
- sk_sp<SkGpuDevice> device(SkGpuDevice::Create(ctxInfo.fGrContext,
- SkBudgeted::kNo,
- SkImageInfo::MakeN32Premul(1, 1),
- 0,
- &props,
- SkGpuDevice::kUninit_InitContents));
- SkCanvas canvas(device.get());
+ sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext,
+ SkBudgeted::kNo,
+ SkImageInfo::MakeN32Premul(1, 1)));
- test_xfermode_cropped_input(&canvas, reporter);
+
+ SkCanvas* canvas = surf->getCanvas();
+
+ test_xfermode_cropped_input(canvas, reporter);
}
DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo) {
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index a8a7966..18d023f 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -14,7 +14,6 @@
#include "SkSpecialSurface.h"
#include "SkSurface.h"
#include "Test.h"
-#include "TestingSpecialImageAccess.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
@@ -53,7 +52,7 @@
static void test_image(const sk_sp<SkSpecialImage>& img, skiatest::Reporter* reporter,
GrContext* context, bool peekTextureSucceeds,
int offset, int size) {
- const SkIRect subset = TestingSpecialImageAccess::Subset(img.get());
+ const SkIRect subset = img->subset();
REPORTER_ASSERT(reporter, offset == subset.left());
REPORTER_ASSERT(reporter, offset == subset.top());
REPORTER_ASSERT(reporter, kSmallerSize == subset.width());
@@ -140,14 +139,13 @@
SkBitmap bm = create_bm();
sk_sp<SkSpecialImage> fullSImage(SkSpecialImage::MakeFromRaster(
- nullptr,
SkIRect::MakeWH(kFullSize, kFullSize),
bm));
const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
{
- sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromRaster(nullptr, subset, bm));
+ sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromRaster(subset, bm));
test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize);
}
@@ -163,15 +161,13 @@
sk_sp<SkImage> fullImage(SkImage::MakeFromBitmap(bm));
sk_sp<SkSpecialImage> fullSImage(SkSpecialImage::MakeFromImage(
- nullptr,
SkIRect::MakeWH(kFullSize, kFullSize),
fullImage));
const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
{
- sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromImage(nullptr, subset,
- fullImage));
+ sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromImage(subset, fullImage));
test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize);
}
@@ -193,7 +189,7 @@
pixmap.erase(SK_ColorRED, subset);
{
- sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromPixmap(nullptr, subset, pixmap,
+ sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromPixmap(subset, pixmap,
nullptr, nullptr));
test_image(img, reporter, nullptr, false, kPad, kFullSize);
}
@@ -222,20 +218,19 @@
{
// raster
sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster(
- nullptr,
SkIRect::MakeWH(kFullSize,
kFullSize),
bm));
{
- sk_sp<SkSpecialImage> fromRaster(rasterImage->makeTextureImage(nullptr, context));
+ sk_sp<SkSpecialImage> fromRaster(rasterImage->makeTextureImage(context));
test_texture_backed(reporter, rasterImage, fromRaster);
}
{
sk_sp<SkSpecialImage> subRasterImage(rasterImage->makeSubset(subset));
- sk_sp<SkSpecialImage> fromSubRaster(subRasterImage->makeTextureImage(nullptr, context));
+ sk_sp<SkSpecialImage> fromSubRaster(subRasterImage->makeTextureImage(context));
test_texture_backed(reporter, subRasterImage, fromSubRaster);
}
}
@@ -257,21 +252,20 @@
}
sk_sp<SkSpecialImage> gpuImage(SkSpecialImage::MakeFromGpu(
- nullptr,
SkIRect::MakeWH(kFullSize,
kFullSize),
kNeedNewImageUniqueID_SpecialImage,
texture));
{
- sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(nullptr, context));
+ sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(context));
test_texture_backed(reporter, gpuImage, fromGPU);
}
{
sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset));
- sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullptr, context));
+ sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(context));
test_texture_backed(reporter, subGPUImage, fromSubGPU);
}
}
@@ -295,7 +289,6 @@
}
sk_sp<SkSpecialImage> fullSImg(SkSpecialImage::MakeFromGpu(
- nullptr,
SkIRect::MakeWH(kFullSize, kFullSize),
kNeedNewImageUniqueID_SpecialImage,
texture));
@@ -304,7 +297,7 @@
{
sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromGpu(
- nullptr, subset,
+ subset,
kNeedNewImageUniqueID_SpecialImage,
texture));
test_image(subSImg1, reporter, context, true, kPad, kFullSize);
diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp
index db1aaf0..7169b5e 100644
--- a/tests/SpecialSurfaceTest.cpp
+++ b/tests/SpecialSurfaceTest.cpp
@@ -20,10 +20,6 @@
static const SkIRect& Subset(const SkSpecialSurface* surf) {
return surf->subset();
}
-
- static const SkIRect& Subset(const SkSpecialImage* img) {
- return img->subset();
- }
};
// Both 'kSmallerSize' and 'kFullSize' need to be a non-power-of-2 to exercise
@@ -51,7 +47,7 @@
sk_sp<SkSpecialImage> img(surf->makeImageSnapshot());
REPORTER_ASSERT(reporter, img);
- const SkIRect imgSubset = TestingSpecialSurfaceAccess::Subset(img.get());
+ const SkIRect imgSubset = img->subset();
REPORTER_ASSERT(reporter, surfSubset == imgSubset);
// the canvas was invalidated by the newImageSnapshot call
@@ -61,7 +57,7 @@
DEF_TEST(SpecialSurface_Raster, reporter) {
SkImageInfo info = SkImageInfo::MakeN32(kSmallerSize, kSmallerSize, kOpaque_SkAlphaType);
- sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRaster(nullptr, info));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRaster(info));
test_surface(surf, reporter, 0);
}
@@ -73,7 +69,7 @@
const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
- sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(nullptr, subset, bm));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(subset, bm));
test_surface(surf, reporter, kPad);
@@ -89,8 +85,7 @@
desc.fWidth = kSmallerSize;
desc.fHeight = kSmallerSize;
- sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(nullptr, ctxInfo.fGrContext,
- desc));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.fGrContext, desc));
test_surface(surf, reporter, 0);
}
@@ -108,7 +103,7 @@
const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
- sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(nullptr, subset, temp));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(subset, temp));
test_surface(surf, reporter, kPad);
diff --git a/tests/TestingSpecialImageAccess.h b/tests/TestingSpecialImageAccess.h
deleted file mode 100644
index 64a6d29..0000000
--- a/tests/TestingSpecialImageAccess.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file
- */
-
-#ifndef TestingSpecialImageAccess_DEFINED
-#define TestingSpecialImageAccess_DEFINED
-
-class TestingSpecialImageAccess {
-public:
- static const SkIRect& Subset(const SkSpecialImage* img) {
- return img->subset();
- }
-};
-
-#endif