Index: content/renderer/pepper/pepper_plugin_instance_impl.cc |
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
index 6894654d3db4f62dc46c0b073ef27158e58e30a4..7d8819cfce8b341032b0fc0efacd85cc81bbd5fe 100644 |
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc |
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
@@ -1545,6 +1545,11 @@ bool PepperPluginInstanceImpl::LoadTextInputInterface() { |
return !!plugin_textinput_interface_; |
} |
+void PepperPluginInstanceImpl::SetLayerTransform(gfx::Transform transform) { |
+ transform_ = transform; |
+ UpdateLayerTransform(); |
+} |
+ |
void PepperPluginInstanceImpl::UpdateLayerTransform() { |
if (!bound_graphics_2d_platform_ || !texture_layer_) { |
// Currently the transform is only applied for Graphics2D. |
@@ -1564,11 +1569,26 @@ void PepperPluginInstanceImpl::UpdateLayerTransform() { |
gfx::Size plugin_size_in_dip(view_data_.rect.size.width, |
view_data_.rect.size.height); |
+ // Adding the SetLayerTransform from Graphics2D to the UV. |
+ // If the transform_ is te identity matrix |
wjmaclean
2016/04/13 14:47:19
the
alessandroa
2016/04/21 15:39:21
Done.
|
+ // then UV will be top_left (0,0) and |
+ // lower_right (plugin_size_in_dip.width() / graphics_2d_size_in_dip.width(), |
+ // plugin_size_in_dip.height() / graphics_2d_size_in_dip.height()) |
+ gfx::PointF Translate = gfx::PointF(transform_.matrix().getFloat(0,3), |
wjmaclean
2016/04/13 14:47:19
Add a comment to warn the reader here that we're a
alessandroa
2016/04/21 15:39:21
Nice one :)
|
+ transform_.matrix().getFloat(1,3)); |
+ float scale = transform_.matrix().getFloat(0,0); |
+ gfx::PointF top_left = gfx::PointF(-1 * Translate.x() / scale , |
wjmaclean
2016/04/13 14:47:18
-Translate.x() ?
alessandroa
2016/04/21 15:39:21
Done.
|
+ -1 * Translate.y() / scale); |
+ gfx::PointF lower_right = gfx::PointF((1 / scale) * plugin_size_in_dip.width() |
+ - 1 * Translate.x() / scale, |
wjmaclean
2016/04/13 14:47:18
Ditto. Also, even if you are using -1, you shouldn
alessandroa
2016/04/21 15:39:21
Acknowledged.
|
+ (1 / scale) * plugin_size_in_dip.height() |
+ - 1 * Translate.y() / scale); |
texture_layer_->SetUV( |
- gfx::PointF(0.0f, 0.0f), |
+ gfx::PointF(top_left.x() / graphics_2d_size_in_dip.width(), |
+ top_left.y() / graphics_2d_size_in_dip.height()), |
gfx::PointF( |
- plugin_size_in_dip.width() / graphics_2d_size_in_dip.width(), |
- plugin_size_in_dip.height() / graphics_2d_size_in_dip.height())); |
+ lower_right.x() / graphics_2d_size_in_dip.width(), |
+ lower_right.y() / graphics_2d_size_in_dip.height())); |
} |
bool PepperPluginInstanceImpl::PluginHasFocus() const { |