| 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 kLinear_SkColorProfileType
); | 427 kLinear_SkColorProfileType
, |
| 428 *texture->getContext()->ca
ps()); |
| 428 uint32_t flags = 0; | 429 uint32_t flags = 0; |
| 429 if (gReadPixelsConfigs[c].fAlphaType == kUnpremul_SkAlphaTyp
e) { | 430 if (gReadPixelsConfigs[c].fAlphaType == kUnpremul_SkAlphaTyp
e) { |
| 430 flags = GrContext::kUnpremul_PixelOpsFlag; | 431 flags = GrContext::kUnpremul_PixelOpsFlag; |
| 431 } | 432 } |
| 432 bmp.lockPixels(); | 433 bmp.lockPixels(); |
| 433 bool success = texture->readPixels(srcRect.fLeft, srcRect.fT
op, bmp.width(), | 434 bool success = texture->readPixels(srcRect.fLeft, srcRect.fT
op, bmp.width(), |
| 434 bmp.height(), dstConfig,
bmp.getPixels(), | 435 bmp.height(), dstConfig,
bmp.getPixels(), |
| 435 bmp.rowBytes(), flags); | 436 bmp.rowBytes(), flags); |
| 436 bmp.unlockPixels(); | 437 bmp.unlockPixels(); |
| 437 check_read(reporter, bmp, srcRect.fLeft, srcRect.fTop, | 438 check_read(reporter, bmp, srcRect.fLeft, srcRect.fTop, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality))
; | 617 SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality))
; |
| 617 | 618 |
| 618 REPORTER_ASSERT(reporter, dataA->equals(dataB)); | 619 REPORTER_ASSERT(reporter, dataA->equals(dataB)); |
| 619 if (false) { | 620 if (false) { |
| 620 dump_to_file("test_image_A.png", dataA); | 621 dump_to_file("test_image_A.png", dataA); |
| 621 dump_to_file("test_image_B.png", dataB); | 622 dump_to_file("test_image_B.png", dataB); |
| 622 } | 623 } |
| 623 } | 624 } |
| 624 } | 625 } |
| 625 #endif | 626 #endif |
| OLD | NEW |