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

Side by Side Diff: tests/ImageTest.cpp

Issue 1860593002: One signature for creating unit tests that run on premade GrContexts (Closed) Base URL: https://skia.googlesource.com/skia.git@try_no_native
Patch Set: another guess to fix windows Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « tests/ImageNewShaderTest.cpp ('k') | tests/PremulAlphaRoundTripTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <functional> 8 #include <functional>
9 #include <initializer_list> 9 #include <initializer_list>
10 #include "DMGpuSupport.h" 10 #include "DMGpuSupport.h"
11 11
12 #include "SkAutoPixmapStorage.h" 12 #include "SkAutoPixmapStorage.h"
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkCanvas.h" 14 #include "SkCanvas.h"
15 #include "SkData.h" 15 #include "SkData.h"
16 #include "SkDevice.h" 16 #include "SkDevice.h"
17 #include "SkImageEncoder.h" 17 #include "SkImageEncoder.h"
18 #include "SkImageGenerator.h" 18 #include "SkImageGenerator.h"
19 #include "SkImage_Base.h" 19 #include "SkImage_Base.h"
20 #include "SkPicture.h" 20 #include "SkPicture.h"
21 #include "SkPictureRecorder.h" 21 #include "SkPictureRecorder.h"
22 #include "SkPixelSerializer.h" 22 #include "SkPixelSerializer.h"
23 #include "SkRRect.h" 23 #include "SkRRect.h"
24 #include "SkStream.h" 24 #include "SkStream.h"
25 #include "SkSurface.h" 25 #include "SkSurface.h"
26 #include "SkUtils.h" 26 #include "SkUtils.h"
27 #include "Test.h" 27 #include "Test.h"
28 28
29 using sk_gpu_test::GrContextFactory; 29 using namespace sk_gpu_test;
30 30
31 static void assert_equal(skiatest::Reporter* reporter, SkImage* a, const SkIRect * subsetA, 31 static void assert_equal(skiatest::Reporter* reporter, SkImage* a, const SkIRect * subsetA,
32 SkImage* b) { 32 SkImage* b) {
33 const int widthA = subsetA ? subsetA->width() : a->width(); 33 const int widthA = subsetA ? subsetA->width() : a->width();
34 const int heightA = subsetA ? subsetA->height() : a->height(); 34 const int heightA = subsetA ? subsetA->height() : a->height();
35 35
36 REPORTER_ASSERT(reporter, widthA == b->width()); 36 REPORTER_ASSERT(reporter, widthA == b->width());
37 REPORTER_ASSERT(reporter, heightA == b->height()); 37 REPORTER_ASSERT(reporter, heightA == b->height());
38 38
39 // see https://bug.skia.org/3965 39 // see https://bug.skia.org/3965
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 decoded = SkImage::MakeFromEncoded(origEncoded, &ir); 169 decoded = SkImage::MakeFromEncoded(origEncoded, &ir);
170 REPORTER_ASSERT(reporter, decoded); 170 REPORTER_ASSERT(reporter, decoded);
171 assert_equal(reporter, image, &ir, decoded.get()); 171 assert_equal(reporter, image, &ir, decoded.get());
172 } 172 }
173 173
174 DEF_TEST(ImageEncode, reporter) { 174 DEF_TEST(ImageEncode, reporter) {
175 test_encode(reporter, create_image().get()); 175 test_encode(reporter, create_image().get());
176 } 176 }
177 177
178 #if SK_SUPPORT_GPU 178 #if SK_SUPPORT_GPU
179 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, context) { 179 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, ctxInfo) {
180 test_encode(reporter, create_gpu_image(context).get()); 180 test_encode(reporter, create_gpu_image(ctxInfo.fGrContext).get());
181 } 181 }
182 #endif 182 #endif
183 183
184 namespace { 184 namespace {
185 185
186 const char* kSerializedData = "serialized"; 186 const char* kSerializedData = "serialized";
187 187
188 class MockSerializer : public SkPixelSerializer { 188 class MockSerializer : public SkPixelSerializer {
189 public: 189 public:
190 MockSerializer(SkData* (*func)()) : fFunc(func), fDidEncode(false) { } 190 MockSerializer(SkData* (*func)()) : fFunc(func), fDidEncode(false) { }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 #include "SkBitmapCache.h" 362 #include "SkBitmapCache.h"
363 363
364 /* 364 /*
365 * This tests the caching (and preemptive purge) of the raster equivalent of a gpu-image. 365 * This tests the caching (and preemptive purge) of the raster equivalent of a gpu-image.
366 * We cache it for performance when drawing into a raster surface. 366 * We cache it for performance when drawing into a raster surface.
367 * 367 *
368 * A cleaner test would know if each drawImage call triggered a read-back from the gpu, 368 * A cleaner test would know if each drawImage call triggered a read-back from the gpu,
369 * but we don't have that facility (at the moment) so we use a little internal knowledge 369 * but we don't have that facility (at the moment) so we use a little internal knowledge
370 * of *how* the raster version is cached, and look for that. 370 * of *how* the raster version is cached, and look for that.
371 */ 371 */
372 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_Gpu2Cpu, reporter, context) { 372 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_Gpu2Cpu, reporter, ctxInfo) {
373 SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType); 373 SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
374 sk_sp<SkImage> image(create_gpu_image(context)); 374 sk_sp<SkImage> image(create_gpu_image(ctxInfo.fGrContext));
375 const uint32_t uniqueID = image->uniqueID(); 375 const uint32_t uniqueID = image->uniqueID();
376 376
377 auto surface(SkSurface::MakeRaster(info)); 377 auto surface(SkSurface::MakeRaster(info));
378 378
379 // now we can test drawing a gpu-backed image into a cpu-backed surface 379 // now we can test drawing a gpu-backed image into a cpu-backed surface
380 380
381 { 381 {
382 SkBitmap cachedBitmap; 382 SkBitmap cachedBitmap;
383 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap)) ; 383 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap)) ;
384 } 384 }
(...skipping 12 matching lines...) Expand all
397 } 397 }
398 } 398 }
399 399
400 image.reset(nullptr); 400 image.reset(nullptr);
401 { 401 {
402 SkBitmap cachedBitmap; 402 SkBitmap cachedBitmap;
403 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap)) ; 403 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap)) ;
404 } 404 }
405 } 405 }
406 406
407 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, context, g lContext) { 407 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, contextInf o) {
408 GrContext* context = contextInfo.fGrContext;
409 sk_gpu_test::GLTestContext* glContext = contextInfo.fGLContext;
410
408 GrContextFactory otherFactory; 411 GrContextFactory otherFactory;
409 GrContextFactory::ContextInfo otherContextInfo = 412 ContextInfo otherContextInfo =
410 otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType); 413 otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType);
411 glContext->makeCurrent(); 414 glContext->makeCurrent();
412 415
413 std::function<sk_sp<SkImage>()> imageFactories[] = { 416 std::function<sk_sp<SkImage>()> imageFactories[] = {
414 create_image, 417 create_image,
415 create_codec_image, 418 create_codec_image,
416 create_data_image, 419 create_data_image,
417 // Create an image from a picture. 420 // Create an image from a picture.
418 create_picture_image, 421 create_picture_image,
419 // Create a texture image. 422 // Create a texture image.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 RasterDataHolder dataHolder; 570 RasterDataHolder dataHolder;
568 image = create_rasterproc_image(&dataHolder); 571 image = create_rasterproc_image(&dataHolder);
569 test_read_pixels(reporter, image.get()); 572 test_read_pixels(reporter, image.get());
570 image.reset(); 573 image.reset();
571 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); 574 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount);
572 575
573 image = create_codec_image(); 576 image = create_codec_image();
574 test_read_pixels(reporter, image.get()); 577 test_read_pixels(reporter, image.get());
575 } 578 }
576 #if SK_SUPPORT_GPU 579 #if SK_SUPPORT_GPU
577 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, context) { 580 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) {
578 test_read_pixels(reporter, create_gpu_image(context).get()); 581 test_read_pixels(reporter, create_gpu_image(ctxInfo.fGrContext).get());
579 } 582 }
580 #endif 583 #endif
581 584
582 static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* ima ge, 585 static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* ima ge,
583 const SkBitmap& bitmap, SkImage::LegacyBitmapMod e mode) { 586 const SkBitmap& bitmap, SkImage::LegacyBitmapMod e mode) {
584 REPORTER_ASSERT(reporter, image->width() == bitmap.width()); 587 REPORTER_ASSERT(reporter, image->width() == bitmap.width());
585 REPORTER_ASSERT(reporter, image->height() == bitmap.height()); 588 REPORTER_ASSERT(reporter, image->height() == bitmap.height());
586 REPORTER_ASSERT(reporter, image->isOpaque() == bitmap.isOpaque()); 589 REPORTER_ASSERT(reporter, image->isOpaque() == bitmap.isOpaque());
587 590
588 if (SkImage::kRO_LegacyBitmapMode == mode) { 591 if (SkImage::kRO_LegacyBitmapMode == mode) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 image = create_rasterproc_image(&dataHolder); 633 image = create_rasterproc_image(&dataHolder);
631 test_legacy_bitmap(reporter, image.get(), mode); 634 test_legacy_bitmap(reporter, image.get(), mode);
632 image.reset(); 635 image.reset();
633 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); 636 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount);
634 637
635 image = create_codec_image(); 638 image = create_codec_image();
636 test_legacy_bitmap(reporter, image.get(), mode); 639 test_legacy_bitmap(reporter, image.get(), mode);
637 } 640 }
638 } 641 }
639 #if SK_SUPPORT_GPU 642 #if SK_SUPPORT_GPU
640 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, context) { 643 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) {
641 const SkImage::LegacyBitmapMode modes[] = { 644 const SkImage::LegacyBitmapMode modes[] = {
642 SkImage::kRO_LegacyBitmapMode, 645 SkImage::kRO_LegacyBitmapMode,
643 SkImage::kRW_LegacyBitmapMode, 646 SkImage::kRW_LegacyBitmapMode,
644 }; 647 };
645 for (auto& mode : modes) { 648 for (auto& mode : modes) {
646 sk_sp<SkImage> image(create_gpu_image(context)); 649 sk_sp<SkImage> image(create_gpu_image(ctxInfo.fGrContext));
647 test_legacy_bitmap(reporter, image.get(), mode); 650 test_legacy_bitmap(reporter, image.get(), mode);
648 } 651 }
649 } 652 }
650 #endif 653 #endif
651 654
652 static void test_peek(skiatest::Reporter* reporter, SkImage* image, bool expectP eekSuccess) { 655 static void test_peek(skiatest::Reporter* reporter, SkImage* image, bool expectP eekSuccess) {
653 SkPixmap pm; 656 SkPixmap pm;
654 bool success = image->peekPixels(&pm); 657 bool success = image->peekPixels(&pm);
655 REPORTER_ASSERT(reporter, expectPeekSuccess == success); 658 REPORTER_ASSERT(reporter, expectPeekSuccess == success);
656 if (success) { 659 if (success) {
(...skipping 17 matching lines...) Expand all
674 RasterDataHolder dataHolder; 677 RasterDataHolder dataHolder;
675 image = create_rasterproc_image(&dataHolder); 678 image = create_rasterproc_image(&dataHolder);
676 test_peek(reporter, image.get(), true); 679 test_peek(reporter, image.get(), true);
677 image.reset(); 680 image.reset();
678 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount); 681 REPORTER_ASSERT(reporter, 1 == dataHolder.fReleaseCount);
679 682
680 image = create_codec_image(); 683 image = create_codec_image();
681 test_peek(reporter, image.get(), false); 684 test_peek(reporter, image.get(), false);
682 } 685 }
683 #if SK_SUPPORT_GPU 686 #if SK_SUPPORT_GPU
684 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, context) { 687 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) {
685 sk_sp<SkImage> image(create_gpu_image(context)); 688 sk_sp<SkImage> image(create_gpu_image(ctxInfo.fGrContext));
686 test_peek(reporter, image.get(), false); 689 test_peek(reporter, image.get(), false);
687 } 690 }
688 #endif 691 #endif
689 692
690 #if SK_SUPPORT_GPU 693 #if SK_SUPPORT_GPU
691 struct TextureReleaseChecker { 694 struct TextureReleaseChecker {
692 TextureReleaseChecker() : fReleaseCount(0) {} 695 TextureReleaseChecker() : fReleaseCount(0) {}
693 int fReleaseCount; 696 int fReleaseCount;
694 static void Release(void* self) { 697 static void Release(void* self) {
695 static_cast<TextureReleaseChecker*>(self)->fReleaseCount++; 698 static_cast<TextureReleaseChecker*>(self)->fReleaseCount++;
696 } 699 }
697 }; 700 };
698 static void check_image_color(skiatest::Reporter* reporter, SkImage* image, SkPM Color expected) { 701 static void check_image_color(skiatest::Reporter* reporter, SkImage* image, SkPM Color expected) {
699 const SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); 702 const SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1);
700 SkPMColor pixel; 703 SkPMColor pixel;
701 REPORTER_ASSERT(reporter, image->readPixels(info, &pixel, sizeof(pixel), 0, 0)); 704 REPORTER_ASSERT(reporter, image->readPixels(info, &pixel, sizeof(pixel), 0, 0));
702 REPORTER_ASSERT(reporter, pixel == expected); 705 REPORTER_ASSERT(reporter, pixel == expected);
703 } 706 }
704 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_NewFromTexture, reporter, context) { 707 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_NewFromTexture, reporter, ctxInfo) {
705 GrTextureProvider* provider = context->textureProvider(); 708 GrTextureProvider* provider = ctxInfo.fGrContext->textureProvider();
706 const int w = 10; 709 const int w = 10;
707 const int h = 10; 710 const int h = 10;
708 SkPMColor storage[w * h]; 711 SkPMColor storage[w * h];
709 const SkPMColor expected0 = SkPreMultiplyColor(SK_ColorRED); 712 const SkPMColor expected0 = SkPreMultiplyColor(SK_ColorRED);
710 sk_memset32(storage, expected0, w * h); 713 sk_memset32(storage, expected0, w * h);
711 GrSurfaceDesc desc; 714 GrSurfaceDesc desc;
712 desc.fFlags = kRenderTarget_GrSurfaceFlag; // needs to be a rendertarget fo r readpixels(); 715 desc.fFlags = kRenderTarget_GrSurfaceFlag; // needs to be a rendertarget fo r readpixels();
713 desc.fOrigin = kDefault_GrSurfaceOrigin; 716 desc.fOrigin = kDefault_GrSurfaceOrigin;
714 desc.fWidth = w; 717 desc.fWidth = w;
715 desc.fHeight = h; 718 desc.fHeight = h;
716 desc.fConfig = kSkia8888_GrPixelConfig; 719 desc.fConfig = kSkia8888_GrPixelConfig;
717 desc.fSampleCnt = 0; 720 desc.fSampleCnt = 0;
718 SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, SkBudgeted::kNo, s torage, w * 4)); 721 SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, SkBudgeted::kNo, s torage, w * 4));
719 if (!tex) { 722 if (!tex) {
720 REPORTER_ASSERT(reporter, false); 723 REPORTER_ASSERT(reporter, false);
721 return; 724 return;
722 } 725 }
723 726
724 GrBackendTextureDesc backendDesc; 727 GrBackendTextureDesc backendDesc;
725 backendDesc.fConfig = kSkia8888_GrPixelConfig; 728 backendDesc.fConfig = kSkia8888_GrPixelConfig;
726 backendDesc.fFlags = kRenderTarget_GrBackendTextureFlag; 729 backendDesc.fFlags = kRenderTarget_GrBackendTextureFlag;
727 backendDesc.fWidth = w; 730 backendDesc.fWidth = w;
728 backendDesc.fHeight = h; 731 backendDesc.fHeight = h;
729 backendDesc.fSampleCnt = 0; 732 backendDesc.fSampleCnt = 0;
730 backendDesc.fTextureHandle = tex->getTextureHandle(); 733 backendDesc.fTextureHandle = tex->getTextureHandle();
731 TextureReleaseChecker releaseChecker; 734 TextureReleaseChecker releaseChecker;
732 sk_sp<SkImage> refImg( 735 sk_sp<SkImage> refImg(
733 SkImage::MakeFromTexture(context, backendDesc, kPremul_SkAlphaType, 736 SkImage::MakeFromTexture(ctxInfo.fGrContext, backendDesc, kPremul_SkAlph aType,
734 TextureReleaseChecker::Release, &releaseChecker )); 737 TextureReleaseChecker::Release, &releaseChecker ));
735 sk_sp<SkImage> cpyImg(SkImage::MakeFromTextureCopy(context, backendDesc, kPr emul_SkAlphaType)); 738 sk_sp<SkImage> cpyImg(SkImage::MakeFromTextureCopy(ctxInfo.fGrContext, backe ndDesc,
739 kPremul_SkAlphaType));
736 740
737 check_image_color(reporter, refImg.get(), expected0); 741 check_image_color(reporter, refImg.get(), expected0);
738 check_image_color(reporter, cpyImg.get(), expected0); 742 check_image_color(reporter, cpyImg.get(), expected0);
739 743
740 // Now lets jam new colors into our "external" texture, and see if the image s notice 744 // Now lets jam new colors into our "external" texture, and see if the image s notice
741 const SkPMColor expected1 = SkPreMultiplyColor(SK_ColorBLUE); 745 const SkPMColor expected1 = SkPreMultiplyColor(SK_ColorBLUE);
742 sk_memset32(storage, expected1, w * h); 746 sk_memset32(storage, expected1, w * h);
743 tex->writePixels(0, 0, w, h, kSkia8888_GrPixelConfig, storage, GrContext::kF lushWrites_PixelOp); 747 tex->writePixels(0, 0, w, h, kSkia8888_GrPixelConfig, storage, GrContext::kF lushWrites_PixelOp);
744 748
745 // The cpy'd one should still see the old color 749 // The cpy'd one should still see the old color
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 uint32_t pixelB = *bpm.addr32(x, y); 792 uint32_t pixelB = *bpm.addr32(x, y);
789 if (pixelA != pixelB) { 793 if (pixelA != pixelB) {
790 ERRORF(reporter, "Expected image pixels to be the same. At %d,%d 0x%08x != 0x%08x", 794 ERRORF(reporter, "Expected image pixels to be the same. At %d,%d 0x%08x != 0x%08x",
791 x, y, pixelA, pixelB); 795 x, y, pixelA, pixelB);
792 return; 796 return;
793 } 797 }
794 } 798 }
795 } 799 }
796 } 800 }
797 801
798 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, context) { 802 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) {
799 for (auto create : {&create_image, 803 for (auto create : {&create_image,
800 &create_image_565, 804 &create_image_565,
801 &create_image_ct}) { 805 &create_image_ct}) {
802 sk_sp<SkImage> image((*create)()); 806 sk_sp<SkImage> image((*create)());
803 if (!image) { 807 if (!image) {
804 ERRORF(reporter, "Could not create image"); 808 ERRORF(reporter, "Could not create image");
805 return; 809 return;
806 } 810 }
807 811
808 SkPixmap pixmap; 812 SkPixmap pixmap;
809 if (!image->peekPixels(&pixmap)) { 813 if (!image->peekPixels(&pixmap)) {
810 ERRORF(reporter, "peek failed"); 814 ERRORF(reporter, "peek failed");
811 } else { 815 } else {
812 sk_sp<SkImage> texImage(SkImage::MakeTextureFromPixmap(context, pixm ap, 816 sk_sp<SkImage> texImage(SkImage::MakeTextureFromPixmap(ctxInfo.fGrCo ntext, pixmap,
813 SkBudgeted::k No)); 817 SkBudgeted::k No));
814 if (!texImage) { 818 if (!texImage) {
815 ERRORF(reporter, "NewTextureFromPixmap failed."); 819 ERRORF(reporter, "NewTextureFromPixmap failed.");
816 } else { 820 } else {
817 check_images_same(reporter, image.get(), texImage.get()); 821 check_images_same(reporter, image.get(), texImage.get());
818 } 822 }
819 } 823 }
820 } 824 }
821 } 825 }
822 826
823 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, context, glCo ntext) { 827 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
828 GrContext* context = ctxInfo.fGrContext;
829 sk_gpu_test::GLTestContext* glContext = ctxInfo.fGLContext;
824 SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy()); 830 SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
825 831
826 GrContextFactory otherFactory; 832 GrContextFactory otherFactory;
827 GrContextFactory::ContextInfo otherContextInfo = 833 ContextInfo otherContextInfo =
828 otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType); 834 otherFactory.getContextInfo(GrContextFactory::kNativeGL_ContextType);
829 835
830 glContext->makeCurrent(); 836 glContext->makeCurrent();
831 REPORTER_ASSERT(reporter, proxy); 837 REPORTER_ASSERT(reporter, proxy);
832 struct { 838 struct {
833 std::function<sk_sp<SkImage> ()> fImageFactory; 839 std::function<sk_sp<SkImage> ()> fImageFactory;
834 bool fExpectation; 840 bool fExpectation;
835 } testCases[] = { 841 } testCases[] = {
836 { create_image, true }, 842 { create_image, true },
837 { create_codec_image, true }, 843 { create_codec_image, true },
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 otherContextInfo.fGrContext, buffer, budgeted)); 891 otherContextInfo.fGrContext, buffer, budgeted));
886 REPORTER_ASSERT(reporter, !newImage2); 892 REPORTER_ASSERT(reporter, !newImage2);
887 glContext->makeCurrent(); 893 glContext->makeCurrent();
888 } 894 }
889 } 895 }
890 sk_free(buffer); 896 sk_free(buffer);
891 } 897 }
892 } 898 }
893 } 899 }
894 #endif 900 #endif
OLDNEW
« no previous file with comments | « tests/ImageNewShaderTest.cpp ('k') | tests/PremulAlphaRoundTripTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698