OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkMathPriv.h" | 10 #include "SkMathPriv.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 } | 439 } |
440 } | 440 } |
441 } | 441 } |
442 } | 442 } |
443 | 443 |
444 ///////////////////// | 444 ///////////////////// |
445 #if SK_SUPPORT_GPU | 445 #if SK_SUPPORT_GPU |
446 | 446 |
447 // make_ringed_bitmap was lifted from gm/bleed.cpp, as that GM was what showed t
he following | 447 // make_ringed_bitmap was lifted from gm/bleed.cpp, as that GM was what showed t
he following |
448 // bug when a change was made to SkImage_Raster.cpp. It is possible that other t
est bitmaps | 448 // bug when a change was made to SkImage_Raster.cpp. It is possible that other t
est bitmaps |
449 // would also tickle skbug.com/4351 but this one is know to do it, so I've paste
d the code | 449 // would also tickle https://bug.skia.org/4351 but this one is know to do it, so
I've pasted the code |
450 // here so we have a dependable repro case. | 450 // here so we have a dependable repro case. |
451 | 451 |
452 // Create a black&white checked texture with 2 1-pixel rings | 452 // Create a black&white checked texture with 2 1-pixel rings |
453 // around the outside edge. The inner ring is red and the outer ring is blue. | 453 // around the outside edge. The inner ring is red and the outer ring is blue. |
454 static void make_ringed_bitmap(SkBitmap* result, int width, int height) { | 454 static void make_ringed_bitmap(SkBitmap* result, int width, int height) { |
455 SkASSERT(0 == width % 2 && 0 == height % 2); | 455 SkASSERT(0 == width % 2 && 0 == height % 2); |
456 | 456 |
457 static const SkPMColor kRed = SkPreMultiplyColor(SK_ColorRED); | 457 static const SkPMColor kRed = SkPreMultiplyColor(SK_ColorRED); |
458 static const SkPMColor kBlue = SkPreMultiplyColor(SK_ColorBLUE); | 458 static const SkPMColor kBlue = SkPreMultiplyColor(SK_ColorBLUE); |
459 static const SkPMColor kBlack = SkPreMultiplyColor(SK_ColorBLACK); | 459 static const SkPMColor kBlack = SkPreMultiplyColor(SK_ColorBLACK); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 551 } |
552 | 552 |
553 /* | 553 /* |
554 * Test two different ways to turn a subset of a bitmap into a texture | 554 * Test two different ways to turn a subset of a bitmap into a texture |
555 * - subset and then upload to a texture | 555 * - subset and then upload to a texture |
556 * - upload to a texture and then subset | 556 * - upload to a texture and then subset |
557 * | 557 * |
558 * These two techniques result in the same pixels (ala readPixels) | 558 * These two techniques result in the same pixels (ala readPixels) |
559 * but when we draw them (rotated+scaled) we don't always get the same results. | 559 * but when we draw them (rotated+scaled) we don't always get the same results. |
560 * | 560 * |
561 * skbug.com/4351 | 561 * https://bug.skia.org/4351 |
562 */ | 562 */ |
563 DEF_GPUTEST(ReadPixels_Subset_Gpu, reporter, factory) { | 563 DEF_GPUTEST(ReadPixels_Subset_Gpu, reporter, factory) { |
564 GrContext* ctx = factory->get(GrContextFactory::kNative_GLContextType); | 564 GrContext* ctx = factory->get(GrContextFactory::kNative_GLContextType); |
565 if (!ctx) { | 565 if (!ctx) { |
566 REPORTER_ASSERT(reporter, false); | 566 REPORTER_ASSERT(reporter, false); |
567 return; | 567 return; |
568 } | 568 } |
569 | 569 |
570 SkBitmap bitmap; | 570 SkBitmap bitmap; |
571 make_ringed_bitmap(&bitmap, 6, 6); | 571 make_ringed_bitmap(&bitmap, 6, 6); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality))
; | 607 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality))
; |
608 | 608 |
609 REPORTER_ASSERT(reporter, dataA->equals(dataB)); | 609 REPORTER_ASSERT(reporter, dataA->equals(dataB)); |
610 if (false) { | 610 if (false) { |
611 dump_to_file("test_image_A.png", dataA); | 611 dump_to_file("test_image_A.png", dataA); |
612 dump_to_file("test_image_B.png", dataB); | 612 dump_to_file("test_image_B.png", dataB); |
613 } | 613 } |
614 } | 614 } |
615 } | 615 } |
616 #endif | 616 #endif |
OLD | NEW |