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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 2216073002: Color: Add ColorCorrectRendering flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decoder_profile
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 }; 55 };
56 } // namespace 56 } // namespace
57 57
58 namespace blink { 58 namespace blink {
59 59
60 static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, bool* surfaceIsAccelerated) 60 static PassRefPtr<SkSurface> createSkSurface(GrContext* gr, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, bool* surfaceIsAccelerated)
61 { 61 {
62 if (gr) 62 if (gr)
63 gr->resetContext(); 63 gr->resetContext();
64 64
65 sk_sp<SkColorSpace> colorSpace;
66 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled())
67 colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
Justin Novosad 2016/08/05 00:17:06 Actually, could you leave this part out? I have a
ccameron 2016/08/05 00:39:49 Sg -- removed.
68
65 SkAlphaType alphaType = (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPre mul_SkAlphaType; 69 SkAlphaType alphaType = (Opaque == opacityMode) ? kOpaque_SkAlphaType : kPre mul_SkAlphaType;
66 SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), alphaTy pe); 70 SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), alphaTy pe, colorSpace);
67 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); 71 SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry);
68 sk_sp<SkSurface> surface; 72 sk_sp<SkSurface> surface;
69 73
70 if (gr) { 74 if (gr) {
71 *surfaceIsAccelerated = true; 75 *surfaceIsAccelerated = true;
72 surface = SkSurface::MakeRenderTarget(gr, SkBudgeted::kNo, info, msaaSam pleCount, Opaque == opacityMode ? 0 : &disableLCDProps); 76 surface = SkSurface::MakeRenderTarget(gr, SkBudgeted::kNo, info, msaaSam pleCount, Opaque == opacityMode ? 0 : &disableLCDProps);
73 } 77 }
74 78
75 if (!surface) { 79 if (!surface) {
76 *surfaceIsAccelerated = false; 80 *surfaceIsAccelerated = false;
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 #endif // USE_IOSURFACE_FOR_2D_CANVAS 996 #endif // USE_IOSURFACE_FOR_2D_CANVAS
993 } 997 }
994 998
995 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) 999 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event)
996 { 1000 {
997 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount)); 1001 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount));
998 hibernationHistogram.count(event); 1002 hibernationHistogram.count(event);
999 } 1003 }
1000 1004
1001 } // namespace blink 1005 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698