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

Side by Side Diff: tests/ImageTest.cpp

Issue 2337803002: Don't copy image buffer when calculating size.
Patch Set: Updating tests. Created 4 years, 1 month 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/image/SkImage_Gpu.cpp ('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>
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 { create_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 907 { create_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
908 kNone_SkFilterQuality, 1, true }, 908 kNone_SkFilterQuality, 1, true },
909 { create_codec_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 909 { create_codec_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
910 kNone_SkFilterQuality, 1, true }, 910 kNone_SkFilterQuality, 1, true },
911 { create_data_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 911 { create_data_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
912 kNone_SkFilterQuality, 1, true }, 912 kNone_SkFilterQuality, 1, true },
913 { create_picture_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 913 { create_picture_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
914 kNone_SkFilterQuality, 1, false }, 914 kNone_SkFilterQuality, 1, false },
915 { [context] { return create_gpu_image(context); }, 915 { [context] { return create_gpu_image(context); },
916 {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 916 {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
917 kNone_SkFilterQuality, 1, false }, 917 kNone_SkFilterQuality, 1, true },
918 // Create a texture image in a another GrContext. 918 // Create a texture image in a another GrContext.
919 // ////////////////
919 { [testContext, otherContextInfo] { 920 { [testContext, otherContextInfo] {
920 otherContextInfo.testContext()->makeCurrent(); 921 otherContextInfo.testContext()->makeCurrent();
921 sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo .grContext()); 922 sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo .grContext());
cblume 2016/10/25 02:51:01 This test is now causing a errors on non-GPU: ../.
bsalomon 2016/10/25 18:27:15 I think this one should still be false, right? If
922 testContext->makeCurrent(); 923 testContext->makeCurrent();
923 return otherContextImage; 924 return otherContextImage;
924 }, {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 925 }, {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
925 kNone_SkFilterQuality, 1, false }, 926 kNone_SkFilterQuality, 1, true },
926 // Create an image that is too large to upload. 927 // Create an image that is too large to upload.
927 { create_image_large, {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 928 { create_image_large, {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
928 kNone_SkFilterQuality, 1, false }, 929 kNone_SkFilterQuality, 1, false },
929 // Create an image that is too large, but is scaled to an acceptable siz e. 930 // Create an image that is too large, but is scaled to an acceptable siz e.
930 { create_image_large, {{SkMatrix::I(), kMedium_SkFilterQuality, 4}}, 931 { create_image_large, {{SkMatrix::I(), kMedium_SkFilterQuality, 4}},
931 kMedium_SkFilterQuality, 16, true}, 932 kMedium_SkFilterQuality, 16, true},
932 // Create an image with multiple low filter qualities, make sure we roun d up. 933 // Create an image with multiple low filter qualities, make sure we roun d up.
933 { create_image_large, {{SkMatrix::I(), kNone_SkFilterQuality, 4}, 934 { create_image_large, {{SkMatrix::I(), kNone_SkFilterQuality, 4},
934 {SkMatrix::I(), kMedium_SkFilterQuality, 4}}, 935 {SkMatrix::I(), kMedium_SkFilterQuality, 4}},
935 kMedium_SkFilterQuality, 16, true}, 936 kMedium_SkFilterQuality, 16, true},
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 SkBitmap bm1; 1045 SkBitmap bm1;
1045 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType)); 1046 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType));
1046 bm0.readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0); 1047 bm0.readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0);
1047 1048
1048 SkBitmap bm2; 1049 SkBitmap bm2;
1049 bm2.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType)); 1050 bm2.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType));
1050 bm1.readPixels(bm2.info(), bm2.getPixels(), bm2.rowBytes(), 0, 0); 1051 bm1.readPixels(bm2.info(), bm2.getPixels(), bm2.rowBytes(), 0, 0);
1051 1052
1052 REPORTER_ASSERT(reporter, equal(bm0, bm2)); 1053 REPORTER_ASSERT(reporter, equal(bm0, bm2));
1053 } 1054 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698