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

Side by Side Diff: tests/ImageTest.cpp

Issue 2337803002: Don't copy image buffer when calculating size.
Patch Set: Making SkImage_Gpu always return false. 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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 { [context] { return create_gpu_image(context); }, 913 { [context] { return create_gpu_image(context); },
914 {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 914 {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
915 kNone_SkFilterQuality, 1, false }, 915 kNone_SkFilterQuality, 1, false },
916 // Create a texture image in a another GrContext. 916 // Create a texture image in a another GrContext.
917 { [testContext, otherContextInfo] { 917 { [testContext, otherContextInfo] {
918 otherContextInfo.testContext()->makeCurrent(); 918 otherContextInfo.testContext()->makeCurrent();
919 sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo .grContext()); 919 sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo .grContext());
920 testContext->makeCurrent(); 920 testContext->makeCurrent();
921 return otherContextImage; 921 return otherContextImage;
922 }, {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 922 }, {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
923 kNone_SkFilterQuality, 1, false }, 923 kNone_SkFilterQuality, 1, true },
924 // Create an image that is too large to upload. 924 // Create an image that is too large to upload.
925 { create_image_large, {{SkMatrix::I(), kNone_SkFilterQuality, 0}}, 925 { create_image_large, {{SkMatrix::I(), kNone_SkFilterQuality, 0}},
926 kNone_SkFilterQuality, 1, false }, 926 kNone_SkFilterQuality, 1, false },
927 // Create an image that is too large, but is scaled to an acceptable siz e. 927 // Create an image that is too large, but is scaled to an acceptable siz e.
928 { create_image_large, {{SkMatrix::I(), kMedium_SkFilterQuality, 4}}, 928 { create_image_large, {{SkMatrix::I(), kMedium_SkFilterQuality, 4}},
929 kMedium_SkFilterQuality, 16, true}, 929 kMedium_SkFilterQuality, 16, true},
930 // Create an image with multiple low filter qualities, make sure we roun d up. 930 // Create an image with multiple low filter qualities, make sure we roun d up.
931 { create_image_large, {{SkMatrix::I(), kNone_SkFilterQuality, 4}, 931 { create_image_large, {{SkMatrix::I(), kNone_SkFilterQuality, 4},
932 {SkMatrix::I(), kMedium_SkFilterQuality, 4}}, 932 {SkMatrix::I(), kMedium_SkFilterQuality, 4}},
933 kMedium_SkFilterQuality, 16, true}, 933 kMedium_SkFilterQuality, 16, true},
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 SkBitmap bm1; 1042 SkBitmap bm1;
1043 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType)); 1043 bm1.allocPixels(SkImageInfo::MakeN32(256, 256, kUnpremul_SkAlphaType));
1044 bm0.readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0); 1044 bm0.readPixels(bm1.info(), bm1.getPixels(), bm1.rowBytes(), 0, 0);
1045 1045
1046 SkBitmap bm2; 1046 SkBitmap bm2;
1047 bm2.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType)); 1047 bm2.allocPixels(SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType));
1048 bm1.readPixels(bm2.info(), bm2.getPixels(), bm2.rowBytes(), 0, 0); 1048 bm1.readPixels(bm2.info(), bm2.getPixels(), bm2.rowBytes(), 0, 0);
1049 1049
1050 REPORTER_ASSERT(reporter, equal(bm0, bm2)); 1050 REPORTER_ASSERT(reporter, equal(bm0, bm2));
1051 } 1051 }
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