OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |