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

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: Remove helper function for old pixel-config method of enabling decode 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') | include/core/SkCanvas.h » ('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::GLContextType contextType = gpuConfig->getContextT ype(); 817 GrContextFactory::GLContextType contextType = gpuConfig->getContextT ype();
818 GrContextFactory::GLContextOptions contextOptions = 818 GrContextFactory::GLContextOptions contextOptions =
819 GrContextFactory::kNone_GLContextOptions; 819 GrContextFactory::kNone_GLContextOptions;
820 if (gpuConfig->getUseNVPR()) { 820 if (gpuConfig->getUseNVPR()) {
821 contextOptions = static_cast<GrContextFactory::GLContextOptions> ( 821 contextOptions = static_cast<GrContextFactory::GLContextOptions> (
822 contextOptions | GrContextFactory::kEnableNVPR_GLContextOpti ons); 822 contextOptions | GrContextFactory::kEnableNVPR_GLContextOpti ons);
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::GLContextOptions> ( 826 contextOptions = static_cast<GrContextFactory::GLContextOptions> (
827 contextOptions | GrContextFactory::kRequireSRGBSupport_GLCon textOptions); 827 contextOptions | GrContextFactory::kRequireSRGBSupport_GLCon textOptions);
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 Reporter* reporter, 1498 Reporter* reporter,
1500 GrContextFactory* fac tory); 1499 GrContextFactory* fac tory);
1501 } // namespace skiatest 1500 } // namespace skiatest
1502 1501
1503 #if !defined(SK_BUILD_FOR_IOS) 1502 #if !defined(SK_BUILD_FOR_IOS)
1504 int main(int argc, char** argv) { 1503 int main(int argc, char** argv) {
1505 SkCommandLineFlags::Parse(argc, argv); 1504 SkCommandLineFlags::Parse(argc, argv);
1506 return dm_main(); 1505 return dm_main();
1507 } 1506 }
1508 #endif 1507 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DMGpuSupport.h » ('j') | include/core/SkCanvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698