Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: content/browser/compositor/reflector_impl.cc

Issue 846063002: compositor: Fix texture flipping for SW mirroring with surfaceless (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: replace with custom task runner that does nothing. maybe this will work Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/compositor/reflector_impl.h ('k') | content/browser/compositor/reflector_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 @@ ReflectorImpl::MainThreadData::MainThreadData(
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 @@ void ReflectorImpl::AttachToOutputSurfaceOnImplThread(
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 @@ void ReflectorImpl::UpdateTextureSizeOnMainThread(gfx::Size size) {
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 @@ void ReflectorImpl::FullRedrawOnMainThread(gfx::Size size) {
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() {
+void ReflectorImpl::FullRedrawContentOnMainThread(bool flip_texture) {
MainThreadData& main = GetMain();
+ main.flip_texture = flip_texture;
main.mirrored_compositor->ScheduleFullRedraw();
}
« no previous file with comments | « content/browser/compositor/reflector_impl.h ('k') | content/browser/compositor/reflector_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698