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

Side by Side Diff: tests/CachedDecodingPixelRefTest.cpp

Issue 1305453007: SkImage method for detecting lazy decoding (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 5 years, 4 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/lazy/SkDiscardablePixelRef.h ('k') | tests/ImageTest.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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 TestImageGenerator::TestType test = testTypes[i]; 319 TestImageGenerator::TestType test = testTypes[i];
320 SkImageGenerator* gen = SkNEW_ARGS(TestImageGenerator, (test, r)); 320 SkImageGenerator* gen = SkNEW_ARGS(TestImageGenerator, (test, r));
321 SkAutoTUnref<SkImage> image(SkImage::NewFromGenerator(gen)); 321 SkAutoTUnref<SkImage> image(SkImage::NewFromGenerator(gen));
322 if (NULL == image.get()) { 322 if (NULL == image.get()) {
323 ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed [" 323 ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed ["
324 SK_SIZE_T_SPECIFIER "]", i); 324 SK_SIZE_T_SPECIFIER "]", i);
325 continue; 325 continue;
326 } 326 }
327 REPORTER_ASSERT(r, TestImageGenerator::Width() == image->width()); 327 REPORTER_ASSERT(r, TestImageGenerator::Width() == image->width());
328 REPORTER_ASSERT(r, TestImageGenerator::Height() == image->height()); 328 REPORTER_ASSERT(r, TestImageGenerator::Height() == image->height());
329 REPORTER_ASSERT(r, image->isLazyGenerated());
329 330
330 SkBitmap bitmap; 331 SkBitmap bitmap;
331 bitmap.allocN32Pixels(TestImageGenerator::Width(), TestImageGenerator::H eight()); 332 bitmap.allocN32Pixels(TestImageGenerator::Width(), TestImageGenerator::H eight());
332 SkCanvas canvas(bitmap); 333 SkCanvas canvas(bitmap);
333 const SkColor kDefaultColor = 0xffabcdef; 334 const SkColor kDefaultColor = 0xffabcdef;
334 canvas.clear(kDefaultColor); 335 canvas.clear(kDefaultColor);
335 canvas.drawImage(image, 0, 0, NULL); 336 canvas.drawImage(image, 0, 0, NULL);
336 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { 337 if (TestImageGenerator::kSucceedGetPixels_TestType == test) {
337 REPORTER_ASSERT( 338 REPORTER_ASSERT(
338 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); 339 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0));
339 } else { 340 } else {
340 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0)); 341 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0));
341 } 342 }
342 } 343 }
343 } 344 }
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.h ('k') | tests/ImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698