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

Unified Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 2212163002: Add some plumbing for the color management of canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
index 75de18b5922262c6f05804b5852b72ff231cf1b8..d814994ba1b81b080c15bc276c6b3fcfea28093f 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -110,8 +110,7 @@ private:
};
CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, const CanvasContextCreationAttributes& attrs, Document& document)
- : CanvasRenderingContext(canvas)
- , m_hasAlpha(attrs.alpha())
+ : CanvasRenderingContext(canvas, nullptr, attrs)
, m_contextLostMode(NotLostContext)
, m_contextRestorable(true)
, m_tryRestoreContextAttemptCount(0)
@@ -785,10 +784,10 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, double x, do
return;
// Currently, SkPictureImageFilter does not support subpixel text anti-aliasing, which
- // is expected when !m_hasAlpha, so we need to fall out of display list mode when
- // drawing text to an opaque canvas
+ // is expected when !creationAttributes().alpha(), so we need to fall out of display
+ // list mode when drawing text to an opaque canvas.
// crbug.com/583809
- if (!m_hasAlpha && !isAccelerated())
+ if (!creationAttributes().alpha() && !isAccelerated())
canvas()->disableDeferral(DisableDeferralReasonSubPixelTextAntiAliasingSupport);
const Font& font = accessFont();
@@ -911,7 +910,8 @@ WebLayer* CanvasRenderingContext2D::platformLayer() const
void CanvasRenderingContext2D::getContextAttributes(Canvas2DContextAttributes& attrs) const
{
- attrs.setAlpha(m_hasAlpha);
+ attrs.setAlpha(creationAttributes().alpha());
+ attrs.setColorSpace(colorSpaceAsString());
}
void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element)

Powered by Google App Engine
This is Rietveld 408576698