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

Side by Side Diff: tests/CachedDecodingPixelRefTest.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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/utils/SkLua.cpp ('k') | tests/FlattenableFactoryToName.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 }; 313 };
314 const SkColorType testColorTypes[] = { 314 const SkColorType testColorTypes[] = {
315 kN32_SkColorType, 315 kN32_SkColorType,
316 kIndex_8_SkColorType, 316 kIndex_8_SkColorType,
317 kRGB_565_SkColorType 317 kRGB_565_SkColorType
318 }; 318 };
319 for (size_t i = 0; i < SK_ARRAY_COUNT(testTypes); ++i) { 319 for (size_t i = 0; i < SK_ARRAY_COUNT(testTypes); ++i) {
320 TestImageGenerator::TestType test = testTypes[i]; 320 TestImageGenerator::TestType test = testTypes[i];
321 for (const SkColorType testColorType : testColorTypes) { 321 for (const SkColorType testColorType : testColorTypes) {
322 SkImageGenerator* gen = new TestImageGenerator(test, r, testColorTyp e); 322 SkImageGenerator* gen = new TestImageGenerator(test, r, testColorTyp e);
323 SkAutoTUnref<SkImage> image(SkImage::NewFromGenerator(gen)); 323 sk_sp<SkImage> image(SkImage::MakeFromGenerator(gen));
324 if (nullptr == image.get()) { 324 if (nullptr == image) {
325 ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed [" 325 ERRORF(r, "SkImage::NewFromGenerator unexpecedly failed ["
326 SK_SIZE_T_SPECIFIER "]", i); 326 SK_SIZE_T_SPECIFIER "]", i);
327 continue; 327 continue;
328 } 328 }
329 REPORTER_ASSERT(r, TestImageGenerator::Width() == image->width()); 329 REPORTER_ASSERT(r, TestImageGenerator::Width() == image->width());
330 REPORTER_ASSERT(r, TestImageGenerator::Height() == image->height()); 330 REPORTER_ASSERT(r, TestImageGenerator::Height() == image->height());
331 REPORTER_ASSERT(r, image->isLazyGenerated()); 331 REPORTER_ASSERT(r, image->isLazyGenerated());
332 332
333 SkBitmap bitmap; 333 SkBitmap bitmap;
334 bitmap.allocN32Pixels(TestImageGenerator::Width(), TestImageGenerato r::Height()); 334 bitmap.allocN32Pixels(TestImageGenerator::Width(), TestImageGenerato r::Height());
335 SkCanvas canvas(bitmap); 335 SkCanvas canvas(bitmap);
336 const SkColor kDefaultColor = 0xffabcdef; 336 const SkColor kDefaultColor = 0xffabcdef;
337 canvas.clear(kDefaultColor); 337 canvas.clear(kDefaultColor);
338 canvas.drawImage(image, 0, 0, nullptr); 338 canvas.drawImage(image, 0, 0, nullptr);
339 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { 339 if (TestImageGenerator::kSucceedGetPixels_TestType == test) {
340 REPORTER_ASSERT( 340 REPORTER_ASSERT(
341 r, TestImageGenerator::Color() == bitmap.getColor(0, 0)); 341 r, TestImageGenerator::Color() == bitmap.getColor(0, 0));
342 } 342 }
343 else { 343 else {
344 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0, 0)); 344 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0, 0));
345 } 345 }
346 } 346 }
347 } 347 }
348 } 348 }
OLDNEW
« no previous file with comments | « src/utils/SkLua.cpp ('k') | tests/FlattenableFactoryToName.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698