aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SpecialImageTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/SpecialImageTest.cpp')
-rw-r--r--tests/SpecialImageTest.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index e992177430..23e8d5b7e3 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -17,6 +17,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
+#include "GrTextureProxy.h"
#endif
@@ -290,4 +291,44 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
}
}
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_DeferredGpu, reporter, ctxInfo) {
+ GrContext* context = ctxInfo.grContext();
+ SkBitmap bm = create_bm();
+
+ GrSurfaceDesc desc;
+ desc.fConfig = kSkia8888_GrPixelConfig;
+ desc.fFlags = kNone_GrSurfaceFlags;
+ desc.fWidth = kFullSize;
+ desc.fHeight = kFullSize;
+
+ sk_sp<GrTextureProxy> proxy(GrTextureProxy::Make(context->textureProvider(), desc,
+ SkBackingFit::kExact, SkBudgeted::kNo,
+ bm.getPixels(), 0));
+ if (!proxy) {
+ return;
+ }
+
+ sk_sp<SkSpecialImage> fullSImg(SkSpecialImage::MakeDeferredFromGpu(
+ context,
+ SkIRect::MakeWH(kFullSize, kFullSize),
+ kNeedNewImageUniqueID_SpecialImage,
+ proxy, nullptr));
+
+ const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
+
+ {
+ sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeDeferredFromGpu(
+ context,
+ subset,
+ kNeedNewImageUniqueID_SpecialImage,
+ proxy, nullptr));
+ test_image(subSImg1, reporter, context, true, kPad, kFullSize);
+ }
+
+ {
+ sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset));
+ test_image(subSImg2, reporter, context, true, kPad, kFullSize);
+ }
+}
+
#endif