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: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 652483003: Plumb in flag to enable antialiased clipping in HTML 5 Canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed code review comments Created 6 years, 2 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
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index a1911e5990147f992e81a3511e0192d35fa2bb4a..c67f4a197298d5ffc0c6dd22804eacfc949fdd70 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -46,6 +46,7 @@
#include "core/events/Event.h"
#include "core/fetch/ImageResource.h"
#include "core/frame/ImageBitmap.h"
+#include "core/frame/Settings.h"
#include "core/html/HTMLCanvasElement.h"
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLMediaElement.h"
@@ -87,9 +88,10 @@ static bool contextLostRestoredEventsEnabled()
return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled();
}
-CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, const Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityParseMode)
+CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, const Canvas2DContextAttributes* attrs, Document& document)
: CanvasRenderingContext(canvas)
- , m_usesCSSCompatibilityParseMode(usesCSSCompatibilityParseMode)
+ , m_usesCSSCompatibilityParseMode(document.inQuirksMode())
+ , m_clipAntialiasing(GraphicsContext::NotAntiAliased)
, m_hasAlpha(!attrs || attrs->alpha())
, m_isContextLost(false)
, m_contextRestorable(true)
@@ -99,6 +101,8 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co
, m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispatchContextRestoredEvent)
, m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreContextEvent)
{
+ if (document.settings() && document.settings()->antialiasedClips2dCanvasEnabled())
+ m_clipAntialiasing = GraphicsContext::AntiAliased;
m_stateStack.append(adoptPtrWillBeNoop(new State()));
}
@@ -1113,7 +1117,7 @@ void CanvasRenderingContext2D::clipInternal(const Path& path, const String& wind
}
realizeSaves(c);
- c->canvasClip(path, parseWinding(windingRuleString));
+ c->canvasClip(path, parseWinding(windingRuleString), m_clipAntialiasing);
modifiableState().m_hasClip = true;
}
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698