Chromium Code Reviews| Index: Source/platform/graphics/Canvas2DLayerBridge.cpp |
| diff --git a/Source/platform/graphics/Canvas2DLayerBridge.cpp b/Source/platform/graphics/Canvas2DLayerBridge.cpp |
| index e74a1c7a0a0bcbbe47e46c8605a3faa68c7880c9..577e93ecd0b0cd17761db7c281a82845b61f3b34 100644 |
| --- a/Source/platform/graphics/Canvas2DLayerBridge.cpp |
| +++ b/Source/platform/graphics/Canvas2DLayerBridge.cpp |
| @@ -88,6 +88,7 @@ Canvas2DLayerBridge::Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider |
| , m_framesSinceMailboxRelease(0) |
| , m_destructionInProgress(false) |
| , m_rateLimitingEnabled(false) |
| + , m_filterLevel(SkPaint::kLow_FilterLevel) |
| , m_isHidden(false) |
| , m_next(0) |
| , m_prev(0) |
| @@ -104,6 +105,7 @@ Canvas2DLayerBridge::Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider |
| m_layer->setBlendBackgroundColor(opacityMode != Opaque); |
| GraphicsLayer::registerContentsLayer(m_layer->layer()); |
| m_layer->setRateLimitContext(m_rateLimitingEnabled); |
| + m_layer->setFilterLevel(m_filterLevel); |
| m_canvas->setNotificationClient(this); |
| #ifndef NDEBUG |
| canvas2DLayerBridgeInstanceCounter.increment(); |
| @@ -152,6 +154,17 @@ void Canvas2DLayerBridge::beginDestruction() |
| ASSERT(!m_bytesAllocated); |
| } |
| +void Canvas2DLayerBridge::setFilterLevel(SkPaint::FilterLevel filterLevel) |
| +{ |
| + printf("Canvas2dLayerBridge::setFilterLevel %d\n", filterLevel); |
|
Justin Novosad
2014/10/28 20:27:44
Don't commit this line.
jackhou1
2014/10/29 00:56:39
Sorry. I'll remove all these before asking for a f
|
| + ASSERT(!m_destructionInProgress); |
| + if (m_filterLevel != filterLevel) { |
| + m_filterLevel = filterLevel; |
| + m_layer->setFilterLevel(m_filterLevel); |
| + m_imageBuffer->notifySurfaceInvalid(); |
| + } |
| +} |
| + |
| void Canvas2DLayerBridge::setIsHidden(bool hidden) |
| { |
| ASSERT(!m_destructionInProgress); |
| @@ -414,7 +427,8 @@ bool Canvas2DLayerBridge::prepareMailbox(WebExternalTextureMailbox* outMailbox, |
| RefPtr<SkImage> image = adoptRef(m_canvas->newImageSnapshot()); |
| // Early exit if canvas was not drawn to since last prepareMailbox |
| - if (image->uniqueID() == m_lastImageId) |
| + GLenum filter = m_filterLevel == SkPaint::kNone_FilterLevel ? GL_NEAREST : GL_LINEAR; |
| + if (image->uniqueID() == m_lastImageId && filter == m_lastFilter) |
| return false; |
| m_lastImageId = image->uniqueID(); |
| @@ -443,8 +457,8 @@ bool Canvas2DLayerBridge::prepareMailbox(WebExternalTextureMailbox* outMailbox, |
| mailboxInfo->m_image->getTexture()->textureParamsModified(); |
| webContext->bindTexture(GL_TEXTURE_2D, mailboxInfo->m_image->getTexture()->getTextureHandle()); |
| - webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| - webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| + webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); |
| + webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); |
|
Justin Novosad
2014/10/28 20:27:44
Does this even matter?
jackhou1
2014/10/29 00:56:39
Without this change, a pixelated canvas is intiall
|
| webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| webContext->produceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo->m_mailbox.name); |