Index: Source/core/html/HTMLCanvasElement.cpp |
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp |
index c973b76cc16dc14a910240b61cf98b8e403e03e8..733e17d863e9a3d7d7a12b85e26bc514013a5ff3 100644 |
--- a/Source/core/html/HTMLCanvasElement.cpp |
+++ b/Source/core/html/HTMLCanvasElement.cpp |
@@ -153,6 +153,8 @@ void HTMLCanvasElement::didRecalcStyle(StyleRecalcChange) |
toWebGLRenderingContext(m_context.get())->setFilterLevel(filterLevel); |
setNeedsCompositingUpdate(); |
} |
+ if (hasImageBuffer()) |
+ m_imageBuffer->setFilterLevel(filterLevel); |
} |
Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(ContainerNode* node) |
@@ -624,8 +626,13 @@ void HTMLCanvasElement::createImageBufferInternal() |
if (!surface->isValid()) |
return; |
+ document().updateRenderTreeIfNeeded(); |
+ RenderStyle* style = computedStyle(); |
+ bool pixelated = style && (style->imageRendering() == ImageRenderingPixelated || style->imageRendering() == ImageRenderingOptimizeContrast); |
+ |
m_imageBuffer = ImageBuffer::create(surface.release()); |
m_imageBuffer->setClient(this); |
+ m_imageBuffer->setFilterLevel(pixelated ? SkPaint::kNone_FilterLevel : SkPaint::kLow_FilterLevel); |
esprehn
2014/12/16 19:22:32
You don't need this line or the bool pixelated or
jackhou1
2014/12/17 01:28:09
This is what I tried earlier but it didn't work. I
|
m_didFailToCreateImageBuffer = false; |
@@ -639,7 +646,7 @@ void HTMLCanvasElement::createImageBufferInternal() |
m_imageBuffer->setClient(this); |
m_imageBuffer->context()->setShouldClampToSourceRect(false); |
m_imageBuffer->context()->disableAntialiasingOptimizationForHairlineImages(); |
- m_imageBuffer->context()->setImageInterpolationQuality(CanvasDefaultInterpolationQuality); |
+ m_imageBuffer->context()->setImageInterpolationQuality(pixelated ? InterpolationLow : CanvasDefaultInterpolationQuality); |
esprehn
2014/12/16 19:22:32
Doesn't this need to be dynamically updated in wil
jackhou1
2014/12/17 01:28:09
Done.
|
// Enabling MSAA overrides a request to disable antialiasing. This is true regardless of whether the |
// rendering mode is accelerated or not. For consistency, we don't want to apply AA in accelerated |
// canvases but not in unaccelerated canvases. |
@@ -810,6 +817,8 @@ PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageMode mod |
return createTransparentImage(size()); |
} |
+ m_imageBuffer->willAccessPixels(); |
+ |
if (m_context->is3d()) { |
m_context->paintRenderingResultsToCanvas(BackBuffer); |
*status = ExternalSourceImageStatus; |