Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: tests/ImageTest.cpp

Issue 2147493004: Add a function to convert a texture backed SkImage to raster. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageTest.cpp
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 4d43e46eb13c487a04cf1325400414831b8b9226..0f760a6c7391d5de4822c7103b305ba42197afb0 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -475,6 +475,33 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, contextInf
}
}
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_makeNonTextureImage, reporter, contextInfo) {
+ GrContext* context = contextInfo.grContext();
+
+ std::function<sk_sp<SkImage>()> imageFactories[] = {
+ create_image,
+ create_codec_image,
+ create_data_image,
+ create_picture_image,
+ [context] { return create_gpu_image(context); },
+ };
+ for (auto factory : imageFactories) {
+ sk_sp<SkImage> image = factory();
+ if (!image->isTextureBacked()) {
+ REPORTER_ASSERT(reporter, image->makeNonTextureImage().get() == image.get());
+ if (!(image = image->makeTextureImage(context))) {
+ continue;
+ }
+ }
+ auto rasterImage = image->makeNonTextureImage();
+ if (!rasterImage) {
+ ERRORF(reporter, "makeNonTextureImage failed for texture-backed image.");
+ }
+ REPORTER_ASSERT(reporter, !rasterImage->isTextureBacked());
+ assert_equal(reporter, image.get(), nullptr, rasterImage.get());
+ }
+}
+
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_drawAbandonedGpuImage, reporter, contextInfo) {
auto context = contextInfo.grContext();
auto image = create_gpu_image(context);
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698