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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 // if the bitmap has pixels allocated before the readPixels, | 418 // if the bitmap has pixels allocated before the readPixels, |
419 // note that and fill them with pattern | 419 // note that and fill them with pattern |
420 bool startsWithPixels = !bmp.isNull(); | 420 bool startsWithPixels = !bmp.isNull(); |
421 // Try doing the read directly from a non-renderable texture | 421 // Try doing the read directly from a non-renderable texture |
422 if (startsWithPixels) { | 422 if (startsWithPixels) { |
423 fill_dst_bmp_with_init_data(&bmp); | 423 fill_dst_bmp_with_init_data(&bmp); |
424 GrPixelConfig dstConfig = | 424 GrPixelConfig dstConfig = |
425 SkImageInfo2GrPixelConfig(gReadPixelsConfigs[c].fCol
orType, | 425 SkImageInfo2GrPixelConfig(gReadPixelsConfigs[c].fCol
orType, |
426 gReadPixelsConfigs[c].fAlp
haType, | 426 gReadPixelsConfigs[c].fAlp
haType, |
427 nullptr, | 427 kLinear_SkColorProfileType
, |
428 *texture->getContext()->ca
ps()); | 428 *texture->getContext()->ca
ps()); |
429 uint32_t flags = 0; | 429 uint32_t flags = 0; |
430 if (gReadPixelsConfigs[c].fAlphaType == kUnpremul_SkAlphaTyp
e) { | 430 if (gReadPixelsConfigs[c].fAlphaType == kUnpremul_SkAlphaTyp
e) { |
431 flags = GrContext::kUnpremul_PixelOpsFlag; | 431 flags = GrContext::kUnpremul_PixelOpsFlag; |
432 } | 432 } |
433 bmp.lockPixels(); | 433 bmp.lockPixels(); |
434 bool success = texture->readPixels(srcRect.fLeft, srcRect.fT
op, bmp.width(), | 434 bool success = texture->readPixels(srcRect.fLeft, srcRect.fT
op, bmp.width(), |
435 bmp.height(), dstConfig,
bmp.getPixels(), | 435 bmp.height(), dstConfig,
bmp.getPixels(), |
436 bmp.rowBytes(), flags); | 436 bmp.rowBytes(), flags); |
437 bmp.unlockPixels(); | 437 bmp.unlockPixels(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB.get(), tx_subset, qua
lity)); | 620 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB.get(), tx_subset, qua
lity)); |
621 | 621 |
622 REPORTER_ASSERT(reporter, dataA->equals(dataB)); | 622 REPORTER_ASSERT(reporter, dataA->equals(dataB)); |
623 if (false) { | 623 if (false) { |
624 dump_to_file("test_image_A.png", dataA); | 624 dump_to_file("test_image_A.png", dataA); |
625 dump_to_file("test_image_B.png", dataB); | 625 dump_to_file("test_image_B.png", dataB); |
626 } | 626 } |
627 } | 627 } |
628 } | 628 } |
629 #endif | 629 #endif |
OLD | NEW |