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

Side by Side Diff: tests/BitmapCopyTest.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « tests/AnnotationTest.cpp ('k') | tests/BlurTest.cpp » ('j') | 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkRect.h" 9 #include "SkRect.h"
10 #include "SkTemplates.h" 10 #include "SkTemplates.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 { false, {-1,-1 }, { 1, 1 }, { 0, 0 }, { 0, 0, 0, 0 } }, 601 { false, {-1,-1 }, { 1, 1 }, { 0, 0 }, { 0, 0, 0, 0 } },
602 }; 602 };
603 603
604 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { 604 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
605 clear_4x4_pixels(dstPixels); 605 clear_4x4_pixels(dstPixels);
606 606
607 dstInfo = dstInfo.makeWH(gRec[i].fRequestedDstSize.width(), 607 dstInfo = dstInfo.makeWH(gRec[i].fRequestedDstSize.width(),
608 gRec[i].fRequestedDstSize.height()); 608 gRec[i].fRequestedDstSize.height());
609 bool success = srcBM.readPixels(dstInfo, dstPixels, rowBytes, 609 bool success = srcBM.readPixels(dstInfo, dstPixels, rowBytes,
610 gRec[i].fRequestedSrcLoc.x(), gRec[i].fR equestedSrcLoc.y()); 610 gRec[i].fRequestedSrcLoc.x(), gRec[i].fR equestedSrcLoc.y());
611 611
612 REPORTER_ASSERT(reporter, gRec[i].fExpectedSuccess == success); 612 REPORTER_ASSERT(reporter, gRec[i].fExpectedSuccess == success);
613 if (success) { 613 if (success) {
614 const SkIRect srcR = gRec[i].fExpectedSrcR; 614 const SkIRect srcR = gRec[i].fExpectedSrcR;
615 const int dstX = gRec[i].fExpectedDstLoc.x(); 615 const int dstX = gRec[i].fExpectedDstLoc.x();
616 const int dstY = gRec[i].fExpectedDstLoc.y(); 616 const int dstY = gRec[i].fExpectedDstLoc.y();
617 // Walk the dst pixels, and check if we got what we expected 617 // Walk the dst pixels, and check if we got what we expected
618 for (int y = 0; y < H; ++y) { 618 for (int y = 0; y < H; ++y) {
619 for (int x = 0; x < W; ++x) { 619 for (int x = 0; x < W; ++x) {
620 SkPMColor dstC = dstPixels[y*4+x]; 620 SkPMColor dstC = dstPixels[y*4+x];
621 // get into src coordinates 621 // get into src coordinates
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 if (dstBmp.colorType() != kDstCTs[dCT]) { 688 if (dstBmp.colorType() != kDstCTs[dCT]) {
689 ERRORF(reporter, "SkBitmap::CopyTo did not respect passed in color type."); 689 ERRORF(reporter, "SkBitmap::CopyTo did not respect passed in color type.");
690 } 690 }
691 SkAutoLockPixels alp(dstBmp); 691 SkAutoLockPixels alp(dstBmp);
692 uint8_t* dstBmpPixels = static_cast<uint8_t*>(dstBmp.getPixels() ); 692 uint8_t* dstBmpPixels = static_cast<uint8_t*>(dstBmp.getPixels() );
693 const uint32_t* refData; 693 const uint32_t* refData;
694 #if defined(SK_PMCOLOR_IS_RGBA) 694 #if defined(SK_PMCOLOR_IS_RGBA)
695 refData = (kRGBA_8888_SkColorType == dstBmp.colorType()) ? kData : swizData; 695 refData = (kRGBA_8888_SkColorType == dstBmp.colorType()) ? kData : swizData;
696 #elif defined(SK_PMCOLOR_IS_BGRA) 696 #elif defined(SK_PMCOLOR_IS_BGRA)
697 refData = (kBGRA_8888_SkColorType == dstBmp.colorType()) ? kData : swizData; 697 refData = (kBGRA_8888_SkColorType == dstBmp.colorType()) ? kData : swizData;
698 #else 698 #else
699 #error "PM Color must be BGRA or RGBA to use GPU backend." 699 #error "PM Color must be BGRA or RGBA to use GPU backend."
700 #endif 700 #endif
701 bool foundError = false; 701 bool foundError = false;
702 for (int y = 0; y < 2 && !foundError; ++y) { 702 for (int y = 0; y < 2 && !foundError; ++y) {
703 uint32_t* dstBmpRow = reinterpret_cast<uint32_t*>(dstBmpPixe ls); 703 uint32_t* dstBmpRow = reinterpret_cast<uint32_t*>(dstBmpPixe ls);
704 for (int x = 0; x < 2 && !foundError; ++x) { 704 for (int x = 0; x < 2 && !foundError; ++x) {
705 if (refData[2 * y + x] != dstBmpRow[x]) { 705 if (refData[2 * y + x] != dstBmpRow[x]) {
706 ERRORF(reporter, "Expected pixel 0x%08x, found 0x%08 x.", 706 ERRORF(reporter, "Expected pixel 0x%08x, found 0x%08 x.",
707 refData[2 * y + x], dstBmpRow[x]); 707 refData[2 * y + x], dstBmpRow[x]);
708 foundError = true; 708 foundError = true;
709 } 709 }
710 } 710 }
711 dstBmpPixels += dstBmp.rowBytes(); 711 dstBmpPixels += dstBmp.rowBytes();
712 } 712 }
713 } 713 }
714 } 714 }
715 } 715 }
716 } 716 }
717 717
718 #endif 718 #endif
OLDNEW
« no previous file with comments | « tests/AnnotationTest.cpp ('k') | tests/BlurTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698