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

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

Issue 2572873002: Add ColorBehavior plumbing for 2D canvas drawImage (Closed)
Patch Set: Created 4 years 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // So if CSS is color corrected from sRGB to display space, then 82 // So if CSS is color corrected from sRGB to display space, then
83 // canvas must do the same 83 // canvas must do the same
84 return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); 84 return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
85 } 85 }
86 return nullptr; 86 return nullptr;
87 }; 87 };
88 CHECK(false); 88 CHECK(false);
89 return nullptr; 89 return nullptr;
90 } 90 }
91 91
92 ColorBehavior CanvasRenderingContext::colorBehaviorForMediaDrawnToCanvas()
93 const {
94 sk_sp<SkColorSpace> colorSpace = skColorSpace();
95 if (colorSpace) {
96 return ColorBehavior::transformTo(std::move(colorSpace));
97 }
98 return ColorBehavior::transformToGlobalTarget();
99 }
100
92 SkColorType CanvasRenderingContext::colorType() const { 101 SkColorType CanvasRenderingContext::colorType() const {
93 switch (m_colorSpace) { 102 switch (m_colorSpace) {
94 case kLinearRGBCanvasColorSpace: 103 case kLinearRGBCanvasColorSpace:
95 return kRGBA_F16_SkColorType; 104 return kRGBA_F16_SkColorType;
96 default: 105 default:
97 return kN32_SkColorType; 106 return kN32_SkColorType;
98 } 107 }
99 } 108 }
100 109
101 void CanvasRenderingContext::dispose() { 110 void CanvasRenderingContext::dispose() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 173 }
165 return taintOrigin; 174 return taintOrigin;
166 } 175 }
167 176
168 DEFINE_TRACE(CanvasRenderingContext) { 177 DEFINE_TRACE(CanvasRenderingContext) {
169 visitor->trace(m_canvas); 178 visitor->trace(m_canvas);
170 visitor->trace(m_offscreenCanvas); 179 visitor->trace(m_offscreenCanvas);
171 } 180 }
172 181
173 } // namespace blink 182 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698