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

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 1846713004: Remove premultipliedAlpha from WebGraphicsContext3D::Attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: premul: tests2 Created 4 years, 9 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/platform/graphics/gpu/DrawingBuffer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 550d0ae50c9144d8c27a878f8250d73ba33935f1..ab504062f627b280d82d5475ec062c5aaa88e8ab 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -90,7 +90,7 @@ static bool shouldFailDrawingBufferCreationForTesting = false;
} // namespace
-PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserve, WebGraphicsContext3D::Attributes requestedAttributes)
+PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const IntSize& size, bool premultipliedAlpha, PreserveDrawingBuffer preserve, WebGraphicsContext3D::Attributes requestedAttributes)
{
ASSERT(contextProvider);
@@ -120,7 +120,7 @@ PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3DP
if (discardFramebufferSupported)
extensionsUtil->ensureExtensionEnabled("GL_EXT_discard_framebuffer");
- RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(std::move(contextProvider), extensionsUtil.release(), multisampleSupported, discardFramebufferSupported, preserve, requestedAttributes));
+ RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(std::move(contextProvider), extensionsUtil.release(), multisampleSupported, discardFramebufferSupported, premultipliedAlpha, preserve, requestedAttributes));
if (!drawingBuffer->initialize(size)) {
drawingBuffer->beginDestruction();
return PassRefPtr<DrawingBuffer>();
@@ -133,7 +133,7 @@ void DrawingBuffer::forceNextDrawingBufferCreationToFail()
shouldFailDrawingBufferCreationForTesting = true;
}
-DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, PassOwnPtr<Extensions3DUtil> extensionsUtil, bool multisampleExtensionSupported, bool discardFramebufferSupported, PreserveDrawingBuffer preserve, WebGraphicsContext3D::Attributes requestedAttributes)
+DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, PassOwnPtr<Extensions3DUtil> extensionsUtil, bool multisampleExtensionSupported, bool discardFramebufferSupported, bool premultipliedAlpha, PreserveDrawingBuffer preserve, WebGraphicsContext3D::Attributes requestedAttributes)
: m_preserveDrawingBuffer(preserve)
, m_scissorEnabled(false)
, m_texture2DBinding(0)
@@ -148,6 +148,7 @@ DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3DProvider> contextPro
, m_requestedAttributes(requestedAttributes)
, m_multisampleExtensionSupported(multisampleExtensionSupported)
, m_discardFramebufferSupported(discardFramebufferSupported)
+ , m_premultipliedAlpha(premultipliedAlpha)
, m_fbo(0)
, m_depthStencilBuffer(0)
, m_multisampleFBO(0)
@@ -267,7 +268,7 @@ bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt
bitmap->setSize(size());
unsigned char* pixels = bitmap->pixels();
- bool needPremultiply = m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha;
+ bool needPremultiply = m_actualAttributes.alpha && !m_premultipliedAlpha;
WebGLImageConversion::AlphaOp op = needPremultiply ? WebGLImageConversion::AlphaDoPremultiply : WebGLImageConversion::AlphaDoNothing;
if (pixels)
readBackFramebuffer(pixels, size().width(), size().height(), ReadbackSkia, op);
@@ -544,9 +545,9 @@ bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gl
GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE;
GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE;
- if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !premultiplyAlpha)
+ if (m_actualAttributes.alpha && m_premultipliedAlpha && !premultiplyAlpha)
unpackUnpremultiplyAlphaNeeded = GL_TRUE;
- else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha && premultiplyAlpha)
+ else if (m_actualAttributes.alpha && !m_premultipliedAlpha && premultiplyAlpha)
unpackPremultiplyAlphaNeeded = GL_TRUE;
gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, flipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded);
@@ -575,7 +576,7 @@ WebLayer* DrawingBuffer::platformLayer()
m_layer->setOpaque(!m_actualAttributes.alpha);
m_layer->setBlendBackgroundColor(m_actualAttributes.alpha);
- m_layer->setPremultipliedAlpha(m_actualAttributes.premultipliedAlpha);
+ m_layer->setPremultipliedAlpha(m_premultipliedAlpha);
m_layer->setNearestNeighbor(m_filterQuality == kNone_SkFilterQuality);
GraphicsLayer::registerContentsLayer(m_layer->layer());
}
@@ -864,7 +865,7 @@ void DrawingBuffer::setPackAlignment(GLint param)
bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, SourceDrawingBuffer sourceBuffer, WTF::ArrayBufferContents& contents)
{
- ASSERT(!m_actualAttributes.premultipliedAlpha);
+ ASSERT(!m_premultipliedAlpha);
width = size().width();
height = size().height();

Powered by Google App Engine
This is Rietveld 408576698