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

Side by Side Diff: dm/DM.cpp

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 8 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 | « no previous file | dm/DMGpuSupport.h » ('j') | src/effects/SkImageSource.cpp » ('J')
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 "CrashHandler.h" 8 #include "CrashHandler.h"
9 #include "DMJsonWriter.h" 9 #include "DMJsonWriter.h"
10 #include "DMSrcSink.h" 10 #include "DMSrcSink.h"
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 #if SK_SUPPORT_GPU 814 #if SK_SUPPORT_GPU
815 if (gpu_supported()) { 815 if (gpu_supported()) {
816 if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) { 816 if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) {
817 GrContextFactory::ContextType contextType = gpuConfig->getContextTyp e(); 817 GrContextFactory::ContextType contextType = gpuConfig->getContextTyp e();
818 GrContextFactory::ContextOptions contextOptions = 818 GrContextFactory::ContextOptions contextOptions =
819 GrContextFactory::kNone_ContextOptions; 819 GrContextFactory::kNone_ContextOptions;
820 if (gpuConfig->getUseNVPR()) { 820 if (gpuConfig->getUseNVPR()) {
821 contextOptions = static_cast<GrContextFactory::ContextOptions>( 821 contextOptions = static_cast<GrContextFactory::ContextOptions>(
822 contextOptions | GrContextFactory::kEnableNVPR_ContextOption s); 822 contextOptions | GrContextFactory::kEnableNVPR_ContextOption s);
823 } 823 }
824 if (kSRGB_SkColorProfileType == gpuConfig->getProfileType() || 824 if (SkColorAndProfileAreGammaCorrect(gpuConfig->getColorType(),
825 kRGBA_F16_SkColorType == gpuConfig->getColorType()) { 825 gpuConfig->getProfileType())) {
826 contextOptions = static_cast<GrContextFactory::ContextOptions>( 826 contextOptions = static_cast<GrContextFactory::ContextOptions>(
827 contextOptions | GrContextFactory::kRequireSRGBSupport_Conte xtOptions); 827 contextOptions | GrContextFactory::kRequireSRGBSupport_Conte xtOptions);
828 } 828 }
829 GrContextFactory testFactory; 829 GrContextFactory testFactory;
830 if (!testFactory.get(contextType, contextOptions)) { 830 if (!testFactory.get(contextType, contextOptions)) {
831 info("WARNING: can not create GPU context for config '%s'. " 831 info("WARNING: can not create GPU context for config '%s'. "
832 "GM tests will be skipped.\n", gpuConfig->getTag().c_str()) ; 832 "GM tests will be skipped.\n", gpuConfig->getTag().c_str()) ;
833 return nullptr; 833 return nullptr;
834 } 834 }
835 return new GPUSink(contextType, contextOptions, gpuConfig->getSample s(), 835 return new GPUSink(contextType, contextOptions, gpuConfig->getSample s(),
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 done(task.sink.tag.c_str(), task.src.tag.c_str(), task.src.options.c_str (), name.c_str()); 1161 done(task.sink.tag.c_str(), task.src.tag.c_str(), task.src.options.c_str (), name.c_str());
1162 } 1162 }
1163 1163
1164 static void WriteToDisk(const Task& task, 1164 static void WriteToDisk(const Task& task,
1165 SkString md5, 1165 SkString md5,
1166 const char* ext, 1166 const char* ext,
1167 SkStream* data, size_t len, 1167 SkStream* data, size_t len,
1168 const SkBitmap* bitmap) { 1168 const SkBitmap* bitmap) {
1169 bool gammaCorrect = false; 1169 bool gammaCorrect = false;
1170 if (bitmap) { 1170 if (bitmap) {
1171 gammaCorrect = bitmap->profileType() == kSRGB_SkColorProfileType 1171 gammaCorrect = SkImageInfoIsGammaCorrect(bitmap->info());
1172 || bitmap-> colorType() == kRGBA_F16_SkColorType;
1173 } 1172 }
1174 1173
1175 JsonWriter::BitmapResult result; 1174 JsonWriter::BitmapResult result;
1176 result.name = task.src->name(); 1175 result.name = task.src->name();
1177 result.config = task.sink.tag; 1176 result.config = task.sink.tag;
1178 result.sourceType = task.src.tag; 1177 result.sourceType = task.src.tag;
1179 result.sourceOptions = task.src.options; 1178 result.sourceOptions = task.src.options;
1180 result.ext = ext; 1179 result.ext = ext;
1181 result.gammaCorrect = gammaCorrect; 1180 result.gammaCorrect = gammaCorrect;
1182 result.md5 = md5; 1181 result.md5 = md5;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 Reporter* reporter, 1499 Reporter* reporter,
1501 GrContextFactory* fac tory); 1500 GrContextFactory* fac tory);
1502 } // namespace skiatest 1501 } // namespace skiatest
1503 1502
1504 #if !defined(SK_BUILD_FOR_IOS) 1503 #if !defined(SK_BUILD_FOR_IOS)
1505 int main(int argc, char** argv) { 1504 int main(int argc, char** argv) {
1506 SkCommandLineFlags::Parse(argc, argv); 1505 SkCommandLineFlags::Parse(argc, argv);
1507 return dm_main(); 1506 return dm_main();
1508 } 1507 }
1509 #endif 1508 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DMGpuSupport.h » ('j') | src/effects/SkImageSource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698