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

Side by Side Diff: tests/ImageTest.cpp

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 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
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tests/LayerDrawLooperTest.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 2015 Google Inc. 2 * Copyright 2015 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 <functional> 8 #include <functional>
9 #include <initializer_list> 9 #include <initializer_list>
10 #include <vector> 10 #include <vector>
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 const SkImageInfo dstInfo = SkImageInfo::MakeN32Premul(2, 2); 344 const SkImageInfo dstInfo = SkImageInfo::MakeN32Premul(2, 2);
345 const size_t dstRowBytes = 2 * sizeof(SkPMColor); 345 const size_t dstRowBytes = 2 * sizeof(SkPMColor);
346 346
347 sk_sp<SkImage> image1(surface->makeImageSnapshot()); 347 sk_sp<SkImage> image1(surface->makeImageSnapshot());
348 REPORTER_ASSERT(reporter, image1->readPixels(dstInfo, pixels, dstRowBytes, 0 , 0)); 348 REPORTER_ASSERT(reporter, image1->readPixels(dstInfo, pixels, dstRowBytes, 0 , 0));
349 for (size_t i = 0; i < SK_ARRAY_COUNT(pixels); ++i) { 349 for (size_t i = 0; i < SK_ARRAY_COUNT(pixels); ++i) {
350 REPORTER_ASSERT(reporter, pixels[i] == green); 350 REPORTER_ASSERT(reporter, pixels[i] == green);
351 } 351 }
352 352
353 SkPaint paint; 353 SkPaint paint;
354 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 354 paint.setBlendMode(SkBlendMode::kSrc);
355 paint.setColor(SK_ColorRED); 355 paint.setColor(SK_ColorRED);
356 356
357 surface->getCanvas()->drawRect(SkRect::MakeXYWH(1, 1, 1, 1), paint); 357 surface->getCanvas()->drawRect(SkRect::MakeXYWH(1, 1, 1, 1), paint);
358 358
359 sk_sp<SkImage> image2(surface->makeImageSnapshot()); 359 sk_sp<SkImage> image2(surface->makeImageSnapshot());
360 REPORTER_ASSERT(reporter, image2->readPixels(dstInfo, pixels, dstRowBytes, 0 , 0)); 360 REPORTER_ASSERT(reporter, image2->readPixels(dstInfo, pixels, dstRowBytes, 0 , 0));
361 REPORTER_ASSERT(reporter, pixels[0] == green); 361 REPORTER_ASSERT(reporter, pixels[0] == green);
362 REPORTER_ASSERT(reporter, pixels[1] == green); 362 REPORTER_ASSERT(reporter, pixels[1] == green);
363 REPORTER_ASSERT(reporter, pixels[2] == green); 363 REPORTER_ASSERT(reporter, pixels[2] == green);
364 REPORTER_ASSERT(reporter, pixels[3] == red); 364 REPORTER_ASSERT(reporter, pixels[3] == red);
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 SkBitmap bm1; 1044 SkBitmap bm1;
1045 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType)); 1045 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType));
1046 bm0.readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0); 1046 bm0.readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0);
1047 1047
1048 SkBitmap bm2; 1048 SkBitmap bm2;
1049 bm2.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType)); 1049 bm2.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType));
1050 bm1.readPixels(bm2.info(), bm2.getPixels(), bm2.rowBytes(), 0, 0); 1050 bm1.readPixels(bm2.info(), bm2.getPixels(), bm2.rowBytes(), 0, 0);
1051 1051
1052 REPORTER_ASSERT(reporter, equal(bm0, bm2)); 1052 REPORTER_ASSERT(reporter, equal(bm0, bm2));
1053 } 1053 }
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tests/LayerDrawLooperTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698