| Index: content/browser/compositor/reflector_impl.cc
|
| diff --git a/content/browser/compositor/reflector_impl.cc b/content/browser/compositor/reflector_impl.cc
|
| index ac3bdda748e0d8c56bf346ddb3f4a73ec643f08d..c2d19b136f07f14b9117810858f2cdae70873108 100644
|
| --- a/content/browser/compositor/reflector_impl.cc
|
| +++ b/content/browser/compositor/reflector_impl.cc
|
| @@ -38,7 +38,9 @@
|
| ui::Layer* mirroring_layer)
|
| : needs_set_mailbox(true),
|
| mirrored_compositor(mirrored_compositor),
|
| - mirroring_layer(mirroring_layer) {}
|
| + mirroring_layer(mirroring_layer),
|
| + flip_texture(false) {
|
| +}
|
|
|
| ReflectorImpl::MainThreadData::~MainThreadData() {}
|
|
|
| @@ -193,10 +195,10 @@
|
| impl.gl_helper->Flush();
|
| output_surface->SetReflector(this);
|
| // The texture doesn't have the data, so invokes full redraw now.
|
| + bool flip_texture = !output_surface->capabilities().flipped_output_surface;
|
| main_message_loop_->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&ReflectorImpl::FullRedrawContentOnMainThread,
|
| - scoped_refptr<ReflectorImpl>(this)));
|
| + FROM_HERE, base::Bind(&ReflectorImpl::FullRedrawContentOnMainThread,
|
| + scoped_refptr<ReflectorImpl>(this), flip_texture));
|
| }
|
|
|
| void ReflectorImpl::UpdateTextureSizeOnMainThread(gfx::Size size) {
|
| @@ -215,6 +217,7 @@
|
| main.mirroring_layer->SetTextureSize(size);
|
| }
|
| main.mirroring_layer->SetBounds(gfx::Rect(size));
|
| + main.mirroring_layer->SetTextureFlipped(main.flip_texture);
|
| }
|
|
|
| void ReflectorImpl::FullRedrawOnMainThread(gfx::Size size) {
|
| @@ -225,20 +228,24 @@
|
| main.mirroring_layer->SchedulePaint(main.mirroring_layer->bounds());
|
| }
|
|
|
| -void ReflectorImpl::UpdateSubBufferOnMainThread(gfx::Size size,
|
| - gfx::Rect rect) {
|
| +void ReflectorImpl::UpdateSubBufferOnMainThread(const gfx::Size& size,
|
| + const gfx::Rect& rect) {
|
| MainThreadData& main = GetMain();
|
| if (!main.mirroring_layer)
|
| return;
|
| UpdateTextureSizeOnMainThread(size);
|
| +
|
| + int y = rect.y();
|
| // Flip the coordinates to compositor's one.
|
| - int y = size.height() - rect.y() - rect.height();
|
| + if (main.flip_texture)
|
| + y = size.height() - rect.y() - rect.height();
|
| gfx::Rect new_rect(rect.x(), y, rect.width(), rect.height());
|
| main.mirroring_layer->SchedulePaint(new_rect);
|
| }
|
|
|
| -void ReflectorImpl::FullRedrawContentOnMainThread() {
|
| - MainThreadData& main = GetMain();
|
| +void ReflectorImpl::FullRedrawContentOnMainThread(bool flip_texture) {
|
| + MainThreadData& main = GetMain();
|
| + main.flip_texture = flip_texture;
|
| main.mirrored_compositor->ScheduleFullRedraw();
|
| }
|
|
|
|
|