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

Side by Side Diff: third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp

Issue 2797213002: Fix BaseRenderingContext2D create/put/get-ImageData() for color managed canvas (Closed)
Patch Set: Corrections Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 gfx::ColorSpace CanvasRenderingContext::GfxColorSpace() const { 103 gfx::ColorSpace CanvasRenderingContext::GfxColorSpace() const {
104 switch (color_space_) { 104 switch (color_space_) {
105 case kLegacyCanvasColorSpace: 105 case kLegacyCanvasColorSpace:
106 return gfx::ColorSpace::CreateSRGB(); 106 return gfx::ColorSpace::CreateSRGB();
107 case kSRGBCanvasColorSpace: 107 case kSRGBCanvasColorSpace:
108 if (pixel_format_ == kF16CanvasPixelFormat) 108 if (pixel_format_ == kF16CanvasPixelFormat)
109 return gfx::ColorSpace::CreateSCRGBLinear(); 109 return gfx::ColorSpace::CreateSCRGBLinear();
110 return gfx::ColorSpace::CreateSRGB(); 110 return gfx::ColorSpace::CreateSRGB();
111 case kRec2020CanvasColorSpace: 111 case kRec2020CanvasColorSpace:
112 return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::BT2020, 112 return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::BT2020,
113 gfx::ColorSpace::TransferID::IEC61966_2_1); 113 gfx::ColorSpace::TransferID::LINEAR_HDR);
114 case kP3CanvasColorSpace: 114 case kP3CanvasColorSpace:
115 return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::SMPTEST432_1, 115 return gfx::ColorSpace(gfx::ColorSpace::PrimaryID::SMPTEST432_1,
116 gfx::ColorSpace::TransferID::IEC61966_2_1); 116 gfx::ColorSpace::TransferID::LINEAR_HDR);
117 } 117 }
118 NOTREACHED(); 118 NOTREACHED();
119 return gfx::ColorSpace(); 119 return gfx::ColorSpace();
120 } 120 }
121 121
122 sk_sp<SkColorSpace> CanvasRenderingContext::SkSurfaceColorSpace() const { 122 sk_sp<SkColorSpace> CanvasRenderingContext::SkSurfaceColorSpace() const {
123 if (SkSurfacesUseColorSpace()) 123 if (SkSurfacesUseColorSpace()) {
124 return GfxColorSpace().ToSkColorSpace(); 124 switch (color_space_) {
125 case kLegacyCanvasColorSpace:
126 return SkColorSpace::MakeSRGB();
127 case kSRGBCanvasColorSpace:
128 if (pixel_format_ == kF16CanvasPixelFormat)
129 return SkColorSpace::MakeSRGBLinear();
130 return SkColorSpace::MakeSRGB();
131 case kRec2020CanvasColorSpace:
132 return SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma,
133 SkColorSpace::kRec2020_Gamut);
134 case kP3CanvasColorSpace:
135 return SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma,
136 SkColorSpace::kDCIP3_D65_Gamut);
137 }
138 }
125 return nullptr; 139 return nullptr;
126 } 140 }
127 141
128 bool CanvasRenderingContext::SkSurfacesUseColorSpace() const { 142 bool CanvasRenderingContext::SkSurfacesUseColorSpace() const {
129 return color_space_ != kLegacyCanvasColorSpace; 143 return color_space_ != kLegacyCanvasColorSpace;
130 } 144 }
131 145
132 ColorBehavior CanvasRenderingContext::ColorBehaviorForMediaDrawnToCanvas() 146 ColorBehavior CanvasRenderingContext::ColorBehaviorForMediaDrawnToCanvas()
133 const { 147 const {
134 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) 148 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled())
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 255 }
242 return taint_origin; 256 return taint_origin;
243 } 257 }
244 258
245 DEFINE_TRACE(CanvasRenderingContext) { 259 DEFINE_TRACE(CanvasRenderingContext) {
246 visitor->Trace(canvas_); 260 visitor->Trace(canvas_);
247 visitor->Trace(offscreen_canvas_); 261 visitor->Trace(offscreen_canvas_);
248 } 262 }
249 263
250 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698