OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |