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

Side by Side Diff: tests/ImageTest.cpp

Issue 2067133002: Add test for rendering an already abandoned texture-backed SkImage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | 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 <vector> 10 #include <vector>
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 } 467 }
468 } 468 }
469 if (image->width() != texImage->width() || image->height() != texImage-> height()) { 469 if (image->width() != texImage->width() || image->height() != texImage-> height()) {
470 ERRORF(reporter, "newTextureImage changed the image size."); 470 ERRORF(reporter, "newTextureImage changed the image size.");
471 } 471 }
472 if (image->isOpaque() != texImage->isOpaque()) { 472 if (image->isOpaque() != texImage->isOpaque()) {
473 ERRORF(reporter, "newTextureImage changed image opaqueness."); 473 ERRORF(reporter, "newTextureImage changed image opaqueness.");
474 } 474 }
475 } 475 }
476 } 476 }
477
478 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_drawAbandonedGpuImage, reporter, cont extInfo) {
479 auto context = contextInfo.grContext();
480 auto image = create_gpu_image(context);
481 auto info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
482 auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
483 as_IB(image)->peekTexture()->abandon();
484 surface->getCanvas()->drawImage(image, 0, 0);
485 }
486
477 #endif 487 #endif
478 488
479 // https://bug.skia.org/4390 489 // https://bug.skia.org/4390
480 DEF_TEST(ImageFromIndex8Bitmap, r) { 490 DEF_TEST(ImageFromIndex8Bitmap, r) {
481 SkPMColor pmColors[1] = {SkPreMultiplyColor(SK_ColorWHITE)}; 491 SkPMColor pmColors[1] = {SkPreMultiplyColor(SK_ColorWHITE)};
482 SkBitmap bm; 492 SkBitmap bm;
483 SkAutoTUnref<SkColorTable> ctable( 493 SkAutoTUnref<SkColorTable> ctable(
484 new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors))); 494 new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
485 SkImageInfo info = 495 SkImageInfo info =
486 SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType); 496 SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType);
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 otherContextInfo.grContext(), buffer, budgeted)); 936 otherContextInfo.grContext(), buffer, budgeted));
927 REPORTER_ASSERT(reporter, !newImage2); 937 REPORTER_ASSERT(reporter, !newImage2);
928 testContext->makeCurrent(); 938 testContext->makeCurrent();
929 } 939 }
930 } 940 }
931 sk_free(buffer); 941 sk_free(buffer);
932 } 942 }
933 } 943 }
934 } 944 }
935 #endif 945 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698