Changeset 100047 in webkit
- Timestamp:
- Nov 11, 2011, 4:57:48 PM (15 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/graphics/chromium/PluginLayerChromium.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/chromium/PluginLayerChromium.h (modified) (2 diffs)
-
WebCore/platform/graphics/chromium/ShaderChromium.cpp (modified) (1 diff)
-
WebCore/platform/graphics/chromium/ShaderChromium.h (modified) (1 diff)
-
WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp (modified) (4 diffs)
-
WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h (modified) (4 diffs)
-
WebKit/chromium/ChangeLog (modified) (1 diff)
-
WebKit/chromium/public/WebExternalTextureLayer.h (modified) (2 diffs)
-
WebKit/chromium/src/WebExternalTextureLayer.cpp (modified) (1 diff)
-
WebKit/chromium/tests/WebLayerTest.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r100046 r100047 1 2011-11-11 Antoine Labour <piman@chromium.org> 2 3 [chromium] Add translation/scaling to WebExternalTextureLayer 4 https://bugs.webkit.org/show_bug.cgi?id=72087 5 6 Reviewed by James Robinson. 7 8 Covered by WebLayerTest. 9 10 * platform/graphics/chromium/PluginLayerChromium.cpp: 11 (WebCore::PluginLayerChromium::PluginLayerChromium): 12 (WebCore::PluginLayerChromium::setUVRect): 13 (WebCore::PluginLayerChromium::pushPropertiesTo): 14 * platform/graphics/chromium/PluginLayerChromium.h: 15 (WebCore::PluginLayerChromium::uvRect): 16 * platform/graphics/chromium/ShaderChromium.cpp: 17 (WebCore::VertexShaderPosTexStretch::VertexShaderPosTexStretch): 18 (WebCore::VertexShaderPosTexStretch::init): 19 (WebCore::VertexShaderPosTexStretch::getShaderString): 20 * platform/graphics/chromium/ShaderChromium.h: 21 (WebCore::VertexShaderPosTexStretch::matrixLocation): 22 (WebCore::VertexShaderPosTexStretch::offsetLocation): 23 (WebCore::VertexShaderPosTexStretch::scaleLocation): 24 * platform/graphics/chromium/cc/CCPluginLayerImpl.cpp: 25 (WebCore::CCPluginLayerImpl::CCPluginLayerImpl): 26 (WebCore::CCPluginLayerImpl::draw): 27 * platform/graphics/chromium/cc/CCPluginLayerImpl.h: 28 (WebCore::CCPluginLayerImpl::setUVRect): 29 1 30 2011-11-11 Stephen Chenney <schenney@chromium.org> 2 31 -
trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
r97550 r100047 46 46 , m_textureId(0) 47 47 , m_flipped(true) 48 , m_uvRect(0, 0, 1, 1) 48 49 { 49 50 } … … 66 67 } 67 68 69 void PluginLayerChromium::setUVRect(const FloatRect& rect) 70 { 71 m_uvRect = rect; 72 setNeedsCommit(); 73 } 74 68 75 void PluginLayerChromium::pushPropertiesTo(CCLayerImpl* layer) 69 76 { … … 73 80 pluginLayer->setTextureId(m_textureId); 74 81 pluginLayer->setFlipped(m_flipped); 82 pluginLayer->setUVRect(m_uvRect); 75 83 } 76 84 -
trunk/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.h
r97550 r100047 46 46 void setFlipped(bool); 47 47 bool flipped() const { return m_flipped; } 48 void setUVRect(const FloatRect&); 49 const FloatRect& uvRect() const { return m_uvRect; } 48 50 49 51 virtual void pushPropertiesTo(CCLayerImpl*); … … 55 57 unsigned m_textureId; 56 58 bool m_flipped; 59 FloatRect m_uvRect; 57 60 }; 58 61 -
trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.cpp
r95901 r100047 64 64 } 65 65 66 VertexShaderPosTexStretch::VertexShaderPosTexStretch() 67 : m_matrixLocation(-1) 68 , m_offsetLocation(-1) 69 , m_scaleLocation(-1) 70 { 71 } 72 73 void VertexShaderPosTexStretch::init(GraphicsContext3D* context, unsigned program) 74 { 75 m_matrixLocation = context->getUniformLocation(program, "matrix"); 76 m_offsetLocation = context->getUniformLocation(program, "offset"); 77 m_scaleLocation = context->getUniformLocation(program, "scale"); 78 ASSERT(m_matrixLocation != -1 && m_offsetLocation != -1 && m_scaleLocation != -1); 79 } 80 81 String VertexShaderPosTexStretch::getShaderString() const 82 { 83 return SHADER( 84 attribute vec4 a_position; 85 attribute vec2 a_texCoord; 86 uniform mat4 matrix; 87 uniform vec2 offset; 88 uniform vec2 scale; 89 varying vec2 v_texCoord; 90 void main() 91 { 92 gl_Position = matrix * a_position; 93 v_texCoord = scale * a_texCoord + offset; 94 } 95 ); 96 } 97 66 98 VertexShaderPosTexYUVStretch::VertexShaderPosTexYUVStretch() 67 99 : m_matrixLocation(-1) -
trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.h
r95901 r100047 52 52 }; 53 53 54 class VertexShaderPosTexStretch { 55 public: 56 VertexShaderPosTexStretch(); 57 58 void init(GraphicsContext3D*, unsigned program); 59 String getShaderString() const; 60 61 int matrixLocation() const { return m_matrixLocation; } 62 int offsetLocation() const { return m_offsetLocation; } 63 int scaleLocation() const { return m_scaleLocation; } 64 65 private: 66 int m_matrixLocation; 67 int m_offsetLocation; 68 int m_scaleLocation; 69 }; 70 54 71 class VertexShaderPosTexYUVStretch { 55 72 public: -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp
r97550 r100047 44 44 samplerLocation = program->fragmentShader().samplerLocation(); 45 45 matrixLocation = program->vertexShader().matrixLocation(); 46 offsetLocation = program->vertexShader().offsetLocation(); 47 scaleLocation = program->vertexShader().scaleLocation(); 46 48 alphaLocation = program->fragmentShader().alphaLocation(); 47 49 } … … 49 51 int samplerLocation; 50 52 int matrixLocation; 53 int offsetLocation; 54 int scaleLocation; 51 55 int alphaLocation; 52 56 }; … … 60 64 , m_textureId(0) 61 65 , m_flipped(true) 66 , m_uvRect(0, 0, 1, 1) 62 67 { 63 68 } … … 89 94 GLC(context, context->useProgram(binding.programId)); 90 95 GLC(context, context->uniform1i(binding.samplerLocation, 0)); 96 GLC(context, context->uniform2f(binding.offsetLocation, m_uvRect.x(), m_uvRect.y())); 97 GLC(context, context->uniform2f(binding.scaleLocation, m_uvRect.width(), m_uvRect.height())); 91 98 layerRenderer->drawTexturedQuad(drawTransform(), bounds().width(), bounds().height(), drawOpacity(), layerRenderer->sharedGeometryQuad(), 92 99 binding.matrixLocation, -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h
r97550 r100047 27 27 #define CCPluginLayerImpl_h 28 28 29 #include "FloatRect.h" 29 30 #include "ProgramBinding.h" 30 31 #include "ShaderChromium.h" … … 41 42 virtual ~CCPluginLayerImpl(); 42 43 43 typedef ProgramBinding<VertexShaderPosTex , FragmentShaderRGBATexAlpha> Program;44 typedef ProgramBinding<VertexShaderPosTex , FragmentShaderRGBATexFlipAlpha> ProgramFlip;44 typedef ProgramBinding<VertexShaderPosTexStretch, FragmentShaderRGBATexAlpha> Program; 45 typedef ProgramBinding<VertexShaderPosTexStretch, FragmentShaderRGBATexFlipAlpha> ProgramFlip; 45 46 46 47 virtual void draw(LayerRendererChromium*); … … 50 51 void setTextureId(unsigned id) { m_textureId = id; } 51 52 void setFlipped(bool flipped) { m_flipped = flipped; } 53 void setUVRect(const FloatRect& rect) { m_uvRect = rect; } 52 54 53 55 private: … … 58 60 unsigned m_textureId; 59 61 bool m_flipped; 62 FloatRect m_uvRect; 60 63 }; 61 64 -
trunk/Source/WebKit/chromium/ChangeLog
r100041 r100047 1 2011-11-11 Antoine Labour <piman@chromium.org> 2 3 [chromium] Add translation/scaling to WebExternalTextureLayer 4 https://bugs.webkit.org/show_bug.cgi?id=72087 5 6 Reviewed by James Robinson. 7 8 * public/WebExternalTextureLayer.h: 9 * src/WebExternalTextureLayer.cpp: 10 (WebKit::WebExternalTextureLayer::setUVRect): 11 (WebKit::WebExternalTextureLayer::uvRect): 12 1 13 2011-11-11 Adam Klein <adamk@chromium.org> 2 14 -
trunk/Source/WebKit/chromium/public/WebExternalTextureLayer.h
r98035 r100047 28 28 29 29 #include "WebCommon.h" 30 #include "WebFloatRect.h" 30 31 #include "WebLayer.h" 31 32 … … 63 64 WEBKIT_EXPORT bool flipped() const; 64 65 66 // Sets the rect in UV space of the texture that is mapped to the layer 67 // bounds. 68 WEBKIT_EXPORT void setUVRect(const WebFloatRect&); 69 WEBKIT_EXPORT WebFloatRect uvRect() const; 70 65 71 #if WEBKIT_IMPLEMENTATION 66 72 WebExternalTextureLayer(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&); -
trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
r97550 r100047 57 57 } 58 58 59 void WebExternalTextureLayer::setUVRect(const WebFloatRect& rect) 60 { 61 unwrap<WebExternalTextureLayerImpl>()->setUVRect(rect); 62 } 63 64 WebFloatRect WebExternalTextureLayer::uvRect() const 65 { 66 return WebFloatRect(constUnwrap<WebExternalTextureLayerImpl>()->uvRect()); 67 } 68 59 69 WebExternalTextureLayer::WebExternalTextureLayer(const PassRefPtr<WebExternalTextureLayerImpl>& node) 60 70 : WebLayer(node) -
trunk/Source/WebKit/chromium/tests/WebLayerTest.cpp
r98630 r100047 30 30 #include "WebExternalTextureLayer.h" 31 31 #include "WebFloatPoint.h" 32 #include "WebFloatRect.h" 32 33 #include "WebLayerClient.h" 33 34 #include "WebRect.h" … … 128 129 EXPECT_TRUE(textureLayer.flipped()); 129 130 131 EXPECT_CALL(client, notifyNeedsComposite()).Times(AtLeast(1)); 132 WebFloatRect uvRect(0.1, 0.1, 0.9, 0.9); 133 textureLayer.setUVRect(uvRect); 134 Mock::VerifyAndClearExpectations(&client); 135 EXPECT_TRUE(textureLayer.flipped()); 136 130 137 131 138 // Content layer.
Note:
See TracChangeset
for help on using the changeset viewer.