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..4d22edc155549e59eac0f701c1aff75b457a8e97 100644 |
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc |
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc |
@@ -1545,6 +1545,13 @@ bool PepperPluginInstanceImpl::LoadTextInputInterface() { |
return !!plugin_textinput_interface_; |
} |
+void PepperPluginInstanceImpl::SetLayerTransform(gfx::Transform transform) { |
+ transform_ = transform; |
+ DCHECK(transform.IsScaleOrTranslation()); |
+ |
+ UpdateLayerTransform(); |
+} |
+ |
void PepperPluginInstanceImpl::UpdateLayerTransform() { |
if (!bound_graphics_2d_platform_ || !texture_layer_) { |
// Currently the transform is only applied for Graphics2D. |
@@ -1564,11 +1571,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 the identity matrix |
+ // 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), |
+ transform_.matrix().getFloat(1,3)); |
+ float scale = transform_.matrix().getFloat(0,0); |
+ gfx::PointF top_left = gfx::PointF(-Translate.x() / scale , |
+ -Translate.y() / scale); |
+ gfx::PointF lower_right = gfx::PointF((1 / scale) * plugin_size_in_dip.width() |
+ -Translate.x() / scale, |
wjmaclean
2016/04/14 20:14:16
I hadn't realized this is the continuation of an e
alessandroa
2016/04/21 15:39:21
Acknowledged.
|
+ (1 / scale) * plugin_size_in_dip.height() |
wjmaclean
2016/04/14 20:14:16
Why is this wrapping around? Is this line longer t
alessandroa
2016/04/21 15:39:21
Yep .. much longer but solved
|
+ -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 { |