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

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: add tests 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
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..ca325b25a6a1188d04b3739e87f0f3b9c64d54bd 100644
--- a/content/browser/compositor/reflector_impl.cc
+++ b/content/browser/compositor/reflector_impl.cc
@@ -23,7 +23,8 @@ ReflectorImpl::ReflectorImpl(
main_unsafe_(mirrored_compositor, mirroring_layer),
impl_message_loop_(compositor_thread_loop),
main_message_loop_(base::MessageLoopProxy::current()),
- surface_id_(surface_id) {
+ surface_id_(surface_id),
+ flip_texture_(false) {
GLHelper* helper = ImageTransportFactory::GetInstance()->GetGLHelper();
MainThreadData& main = GetMain();
main.mailbox = new OwnedMailbox(helper);
@@ -183,6 +184,7 @@ void ReflectorImpl::AttachToOutputSurfaceOnImplThread(
if (impl.output_surface)
DetachFromOutputSurface();
impl.output_surface = output_surface;
+ flip_texture_ = !output_surface->capabilities().flipped_output_surface;
danakj 2015/01/22 01:04:20 capabilities are not initialized until the context
achaulk 2015/01/23 16:45:52 Done.
output_surface->context_provider()->BindToCurrentThread();
impl.gl_helper.reset(
new GLHelper(output_surface->context_provider()->ContextGL(),
@@ -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(flip_texture_);
}
void ReflectorImpl::FullRedrawOnMainThread(gfx::Size size) {
@@ -225,14 +228,17 @@ 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 (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);
}

Powered by Google App Engine
This is Rietveld 408576698