Changeset 139674 in webkit
- Timestamp:
- Jan 14, 2013 3:11:04 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139673 r139674 1 2013-01-14 Huang Dongsung <luxtella@company100.net> 2 3 [TexMap] Use a premuliplied color in TextureMapperGL. 4 https://bugs.webkit.org/show_bug.cgi?id=105786 5 6 Reviewed by Noam Rosenthal. 7 8 Created new tests for composited background colors with fractional 9 number opacity. This test is similar to background-color-alpha.html 10 11 * compositing/background-color/background-color-alpha-with-opacity-expected.html: Added. 12 * compositing/background-color/background-color-alpha-with-opacity.html: Added. 13 1 14 2013-01-14 Arko Saha <arko@motorola.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r139673 r139674 1 2013-01-14 Huang Dongsung <luxtella@company100.net> 2 3 [TexMap] Use a premuliplied color in TextureMapperGL. 4 https://bugs.webkit.org/show_bug.cgi?id=105786 5 6 Reviewed by Noam Rosenthal. 7 8 TextureMapperGL always uses a premultiplied color, so we must convert 9 an unmultiplied color to a premultiplied color before setting the uniform value of 10 colorLocation. 11 12 Test: compositing/background-color/background-color-alpha-with-opacity.html 13 14 * platform/graphics/texmap/TextureMapperGL.cpp: 15 (WebCore::TextureMapperGL::drawBorder): 16 (WebCore::TextureMapperGL::drawSolidColor): 17 (WebCore::prepareFilterProgram): 18 * platform/graphics/texmap/TextureMapperLayer.cpp: 19 (WebCore::blendWithOpacity): 20 (WebCore): 21 (WebCore::TextureMapperLayer::paintSelf): 22 TextureMapperLayer must not convert solidColor to premultiplied 23 color, because TextureMapperImageBuffer expects unmultiplied color. 24 1 25 2013-01-14 Arko Saha <arko@motorola.com> 2 26 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
r138891 r139674 303 303 304 304 float r, g, b, a; 305 color.getRGBA(r, g, b, a);305 Color(premultipliedARGBFromColor(color)).getRGBA(r, g, b, a); 306 306 m_context3D->uniform4f(program->colorLocation(), r, g, b, a); 307 307 m_context3D->lineWidth(width); … … 432 432 433 433 float r, g, b, a; 434 color.getRGBA(r, g, b, a);434 Color(premultipliedARGBFromColor(color)).getRGBA(r, g, b, a); 435 435 m_context3D->uniform4f(program->colorLocation(), r, g, b, a); 436 436 if (a < 1) … … 825 825 // Second pass: we need the shadow color and the content texture for compositing. 826 826 float r, g, b, a; 827 shadow.color().getRGBA(r, g, b, a);827 Color(premultipliedARGBFromColor(shadow.color())).getRGBA(r, g, b, a); 828 828 context->uniform4f(program->colorLocation(), r, g, b, a); 829 829 context->uniform2f(program->blurRadiusLocation(), 0, shadow.stdDeviation() / float(size.height())); -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
r139526 r139674 105 105 } 106 106 107 static Color blendWithOpacity(const Color& color, float opacity) 108 { 109 RGBA32 rgba = color.rgb(); 110 // See Color::getRGBA() to know how to extract alpha from color. 111 float alpha = alphaChannel(rgba) / 255.; 112 float effectiveAlpha = alpha * opacity; 113 return Color(colorWithOverrideAlpha(rgba, effectiveAlpha)); 114 } 115 107 116 void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options) 108 117 { … … 120 129 121 130 if (m_state.solidColor.isValid() && !m_state.contentsRect.isEmpty()) { 122 if (!m_state.solidColor.alpha()) 123 return; 124 125 Color color = m_state.solidColor; 126 float r, g, b, a; 127 color.getRGBA(r, g, b, a); 128 color = Color(r * opacity, g * opacity, b * opacity, a * opacity); 129 options.textureMapper->drawSolidColor(m_state.contentsRect, transform, color); 131 options.textureMapper->drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, opacity)); 130 132 return; 131 133 }
Note: See TracChangeset
for help on using the changeset viewer.