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

Side by Side Diff: tests/BitmapCopyTest.cpp

Issue 27487003: Third wave of Win64 warning cleanup (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Got compiling on linux Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/utils/SkPDFRasterizer.cpp ('k') | tests/PictureTest.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkRect.h" 10 #include "SkRect.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 default: 408 default:
409 break; 409 break;
410 } 410 }
411 if (sizeFail) { 411 if (sizeFail) {
412 SkString str; 412 SkString str;
413 str.printf("getSafeSize64() wrong size: %s", 413 str.printf("getSafeSize64() wrong size: %s",
414 getSkConfigName(tstSafeSize)); 414 getSkConfigName(tstSafeSize));
415 reporter->reportFailed(str); 415 reporter->reportFailed(str);
416 } 416 }
417 417
418 size_t subW, subH; 418 int subW, subH;
419 // Set sizes to be height = 2 to force the last row of the 419 // Set sizes to be height = 2 to force the last row of the
420 // source to be used, thus verifying correct operation if 420 // source to be used, thus verifying correct operation if
421 // the bitmap is an extracted subset. 421 // the bitmap is an extracted subset.
422 if (gPairs[i].fConfig == SkBitmap::kA1_Config) { 422 if (gPairs[i].fConfig == SkBitmap::kA1_Config) {
423 // If one-bit per pixel, use 9 pixels to force more than 423 // If one-bit per pixel, use 9 pixels to force more than
424 // one byte per row. 424 // one byte per row.
425 subW = 9; 425 subW = 9;
426 subH = 2; 426 subH = 2;
427 } else { 427 } else {
428 // All other configurations are at least one byte per pixel, 428 // All other configurations are at least one byte per pixel,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 srcReady = src.copyTo(&subset, src.getConfig()); 465 srcReady = src.copyTo(&subset, src.getConfig());
466 } 466 }
467 467
468 // Not all configurations will generate a valid 'subset'. 468 // Not all configurations will generate a valid 'subset'.
469 if (srcReady) { 469 if (srcReady) {
470 470
471 // Allocate our target buffer 'buf' for all copies. 471 // Allocate our target buffer 'buf' for all copies.
472 // To simplify verifying correctness of copies attach 472 // To simplify verifying correctness of copies attach
473 // buf to a SkBitmap, but copies are done using the 473 // buf to a SkBitmap, but copies are done using the
474 // raw buffer pointer. 474 // raw buffer pointer.
475 const uint32_t bufSize = subH * 475 const size_t bufSize = subH *
476 SkBitmap::ComputeRowBytes(src.getConfig(), subW) * 2; 476 SkBitmap::ComputeRowBytes(src.getConfig(), subW) * 2;
477 SkAutoMalloc autoBuf (bufSize); 477 SkAutoMalloc autoBuf (bufSize);
478 uint8_t* buf = static_cast<uint8_t*>(autoBuf.get()); 478 uint8_t* buf = static_cast<uint8_t*>(autoBuf.get());
479 479
480 SkBitmap bufBm; // Attach buf to this bitmap. 480 SkBitmap bufBm; // Attach buf to this bitmap.
481 bool successExpected; 481 bool successExpected;
482 482
483 // Set up values for each pixel being copied. 483 // Set up values for each pixel being copied.
484 Coordinates coords(subW * subH); 484 Coordinates coords(subW * subH);
485 for (size_t x = 0; x < subW; ++x) 485 for (int x = 0; x < subW; ++x)
486 for (size_t y = 0; y < subH; ++y) 486 for (int y = 0; y < subH; ++y)
487 { 487 {
488 int index = y * subW + x; 488 int index = y * subW + x;
489 SkASSERT(index < coords.length); 489 SkASSERT(index < coords.length);
490 coords[index]->fX = x; 490 coords[index]->fX = x;
491 coords[index]->fY = y; 491 coords[index]->fY = y;
492 } 492 }
493 493
494 writeCoordPixels(subset, coords); 494 writeCoordPixels(subset, coords);
495 495
496 // Test #1 //////////////////////////////////////////// 496 // Test #1 ////////////////////////////////////////////
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 false); 595 false);
596 596
597 #endif 597 #endif
598 } 598 }
599 } // for (size_t copyCase ... 599 } // for (size_t copyCase ...
600 } 600 }
601 } 601 }
602 602
603 #include "TestClassDef.h" 603 #include "TestClassDef.h"
604 DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy) 604 DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy)
OLDNEW
« no previous file with comments | « src/utils/SkPDFRasterizer.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698