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

Side by Side Diff: tests/ImageTest.cpp

Issue 2203143002: GN: add tests to DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Headers use json -> public_deps Created 4 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 | « BUILD.gn ('k') | no next file » | 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>
11 #include "DMGpuSupport.h"
12 11
13 #include "SkAutoPixmapStorage.h" 12 #include "SkAutoPixmapStorage.h"
14 #include "SkBitmap.h" 13 #include "SkBitmap.h"
15 #include "SkCanvas.h" 14 #include "SkCanvas.h"
16 #include "SkData.h" 15 #include "SkData.h"
17 #include "SkImageEncoder.h" 16 #include "SkImageEncoder.h"
18 #include "SkImageGenerator.h" 17 #include "SkImageGenerator.h"
19 #include "SkImage_Base.h" 18 #include "SkImage_Base.h"
20 #include "SkImagePriv.h" 19 #include "SkImagePriv.h"
21 #include "SkPicture.h" 20 #include "SkPicture.h"
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 return true; 993 return true;
995 } 994 }
996 995
997 DEF_TEST(image_roundtrip_encode, reporter) { 996 DEF_TEST(image_roundtrip_encode, reporter) {
998 SkBitmap bm0; 997 SkBitmap bm0;
999 make_all_premul(&bm0); 998 make_all_premul(&bm0);
1000 999
1001 auto img0 = SkImage::MakeFromBitmap(bm0); 1000 auto img0 = SkImage::MakeFromBitmap(bm0);
1002 sk_sp<SkData> data(img0->encode(SkImageEncoder::kPNG_Type, 100)); 1001 sk_sp<SkData> data(img0->encode(SkImageEncoder::kPNG_Type, 100));
1003 auto img1 = SkImage::MakeFromEncoded(data); 1002 auto img1 = SkImage::MakeFromEncoded(data);
1004 1003
1005 SkBitmap bm1; 1004 SkBitmap bm1;
1006 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType)); 1005 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType));
1007 img1->readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0); 1006 img1->readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0);
1008 1007
1009 REPORTER_ASSERT(reporter, equal(bm0, bm1)); 1008 REPORTER_ASSERT(reporter, equal(bm0, bm1));
1010 } 1009 }
1011 1010
1012 DEF_TEST(image_roundtrip_premul, reporter) { 1011 DEF_TEST(image_roundtrip_premul, reporter) {
1013 SkBitmap bm0; 1012 SkBitmap bm0;
1014 make_all_premul(&bm0); 1013 make_all_premul(&bm0);
1015 1014
1016 SkBitmap bm1; 1015 SkBitmap bm1;
1017 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType)); 1016 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType));
1018 bm0.readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0); 1017 bm0.readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0);
1019 1018
1020 SkBitmap bm2; 1019 SkBitmap bm2;
1021 bm2.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType)); 1020 bm2.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType));
1022 bm1.readPixels(bm2.info(), bm2.getPixels(), bm2.rowBytes(), 0, 0); 1021 bm1.readPixels(bm2.info(), bm2.getPixels(), bm2.rowBytes(), 0, 0);
1023 1022
1024 REPORTER_ASSERT(reporter, equal(bm0, bm2)); 1023 REPORTER_ASSERT(reporter, equal(bm0, bm2));
1025 } 1024 }
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698