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

Side by Side Diff: tests/ReadPixelsTest.cpp

Issue 1789663002: sRGB support in Ganesh. Several pieces: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Squelch assert when blurring sRGB Created 4 years, 9 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 | « src/views/SkWindow.cpp ('k') | 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 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
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
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
OLDNEW
« no previous file with comments | « src/views/SkWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698