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

Unified Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 562583002: Implement image-rendering:pixelated for accelerated 2D canvases. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change setNearestNeighbor to setFilterLevel, use SkPaint::FilterLevel. Created 6 years, 3 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/HTMLCanvasElement.h ('k') | Source/platform/graphics/Canvas2DImageBufferSurface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index 7ce2ab15d2123fd7ffbe0fb1ff33a233e4d4e435..b85e9bb3dbd76999547a6eb06ce86d62d10a9fe6 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -86,6 +86,7 @@ inline HTMLCanvasElement::HTMLCanvasElement(Document& document)
, m_didFailToCreateImageBuffer(false)
, m_didClearImageBuffer(false)
{
+ setHasCustomStyleCallbacks();
}
DEFINE_NODE_FACTORY(HTMLCanvasElement)
@@ -119,6 +120,11 @@ RenderObject* HTMLCanvasElement::createRenderer(RenderStyle* style)
return HTMLElement::createRenderer(style);
}
+void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange)
+{
+ m_imageBuffer->setFilterLevel(computedStyle()->imageRendering() == ImageRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel);
Justin Novosad 2014/09/11 15:42:30 You need to verify hasImageBuffer() here. If the
+}
+
Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode* node)
{
setIsInCanvasSubtree(true);
@@ -490,6 +496,7 @@ PassOwnPtr<ImageBufferSurface> HTMLCanvasElement::createImageBufferSurface(const
if (document().settings())
*msaaSampleCount = document().settings()->accelerated2dCanvasMSAASampleCount();
OwnPtr<ImageBufferSurface> surface = adoptPtr(new Canvas2DImageBufferSurface(size(), opacityMode, *msaaSampleCount));
+ surface->setFilterLevel(computedStyle()->imageRendering() == ImageRenderingPixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel);
if (surface->isValid())
return surface.release();
}
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/platform/graphics/Canvas2DImageBufferSurface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698