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

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: 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..e04edcd07406b5ff83e241b4b48d2fd86ddce6d9 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/12 18:27:30 This is getting the flipped-ness of the current ou
achaulk 2015/01/12 18:47:35 All that matters is the flipped-ness of the source
danakj 2015/01/12 19:02:42 Oh this is the source surface? OK great :) I read
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) {
@@ -231,10 +234,14 @@ void ReflectorImpl::UpdateSubBufferOnMainThread(gfx::Size size,
if (!main.mirroring_layer)
return;
UpdateTextureSizeOnMainThread(size);
- // Flip the coordinates to compositor's one.
- int y = size.height() - rect.y() - rect.height();
- gfx::Rect new_rect(rect.x(), y, rect.width(), rect.height());
- main.mirroring_layer->SchedulePaint(new_rect);
+ if(flip_texture_) {
+ // Flip the coordinates to compositor's one.
+ int y = size.height() - rect.y() - rect.height();
+ gfx::Rect new_rect(rect.x(), y, rect.width(), rect.height());
+ main.mirroring_layer->SchedulePaint(new_rect);
+ } else {
+ main.mirroring_layer->SchedulePaint(rect);
danakj 2015/01/12 18:27:30 How about just doing rect math inside an if/else a
achaulk 2015/01/12 18:47:35 Sure
+ }
}
void ReflectorImpl::FullRedrawContentOnMainThread() {

Powered by Google App Engine
This is Rietveld 408576698