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

Side by Side Diff: tests/CachedDecodingPixelRefTest.cpp

Issue 510423005: make allocPixels throw on failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 3 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/BitmapTest.cpp ('k') | tests/DrawBitmapRectTest.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 2013 Google Inc. 2 * Copyright 2013 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 "SkCachingPixelRef.h" 9 #include "SkCachingPixelRef.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 if (NULL == image.get()) { 342 if (NULL == image.get()) {
343 ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed [" 343 ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed ["
344 SK_SIZE_T_SPECIFIER "]", i); 344 SK_SIZE_T_SPECIFIER "]", i);
345 continue; 345 continue;
346 } 346 }
347 REPORTER_ASSERT(r, TestImageGenerator::Width() == image->width()); 347 REPORTER_ASSERT(r, TestImageGenerator::Width() == image->width());
348 REPORTER_ASSERT(r, TestImageGenerator::Height() == image->height()); 348 REPORTER_ASSERT(r, TestImageGenerator::Height() == image->height());
349 349
350 SkBitmap bitmap; 350 SkBitmap bitmap;
351 SkAssertResult(bitmap.allocN32Pixels(TestImageGenerator::Width(), 351 bitmap.allocN32Pixels(TestImageGenerator::Width(), TestImageGenerator::H eight());
352 TestImageGenerator::Height()));
353 SkCanvas canvas(bitmap); 352 SkCanvas canvas(bitmap);
354 const SkColor kDefaultColor = 0xffabcdef; 353 const SkColor kDefaultColor = 0xffabcdef;
355 canvas.clear(kDefaultColor); 354 canvas.clear(kDefaultColor);
356 image->draw(&canvas, 0, 0, NULL); 355 image->draw(&canvas, 0, 0, NULL);
357 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { 356 if (TestImageGenerator::kSucceedGetPixels_TestType == test) {
358 REPORTER_ASSERT( 357 REPORTER_ASSERT(
359 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); 358 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0));
360 } else { 359 } else {
361 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0)); 360 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0));
362 } 361 }
363 } 362 }
364 } 363 }
OLDNEW
« no previous file with comments | « tests/BitmapTest.cpp ('k') | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698