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

Unified Diff: content/renderer/android/synchronous_compositor_frame_sink.cc

Issue 2377533002: cc: Remove Display::SetExternalViewport. (Closed)
Patch Set: webview-expand-sw: . Created 4 years, 3 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/renderer/android/synchronous_compositor_frame_sink.cc
diff --git a/content/renderer/android/synchronous_compositor_frame_sink.cc b/content/renderer/android/synchronous_compositor_frame_sink.cc
index 3ba0cf799f49e73070c197c8a1c2952feb08871a..f1bad047a60419ab4d8186427d142bdde30be361 100644
--- a/content/renderer/android/synchronous_compositor_frame_sink.cc
+++ b/content/renderer/android/synchronous_compositor_frame_sink.cc
@@ -173,10 +173,9 @@ bool SynchronousCompositorFrameSink::BindToClient(
cc::RendererSettings software_renderer_settings;
- std::unique_ptr<SoftwareOutputSurface> compositor_frame_sink(
- new SoftwareOutputSurface(
- base::MakeUnique<SoftwareDevice>(&current_sw_canvas_)));
- software_compositor_frame_sink_ = compositor_frame_sink.get();
+ auto output_surface = base::MakeUnique<SoftwareOutputSurface>(
+ base::MakeUnique<SoftwareDevice>(&current_sw_canvas_));
+ software_output_surface_ = output_surface.get();
// The shared_bitmap_manager and gpu_memory_buffer_manager here are null as
// this Display is only used for resourcesless software draws, where no
@@ -185,7 +184,7 @@ bool SynchronousCompositorFrameSink::BindToClient(
display_.reset(new cc::Display(
nullptr /* shared_bitmap_manager */,
nullptr /* gpu_memory_buffer_manager */, software_renderer_settings,
- nullptr /* begin_frame_source */, std::move(compositor_frame_sink),
+ nullptr /* begin_frame_source */, std::move(output_surface),
nullptr /* scheduler */, nullptr /* texture_mailbox_deleter */));
display_->Initialize(&display_client_, surface_manager_.get(),
surface_id_allocator_->client_id());
@@ -207,7 +206,7 @@ void SynchronousCompositorFrameSink::DetachFromClient() {
surface_id_allocator_->client_id());
surface_manager_->InvalidateSurfaceClientId(
surface_id_allocator_->client_id());
- software_compositor_frame_sink_ = nullptr;
+ software_output_surface_ = nullptr;
display_ = nullptr;
surface_factory_ = nullptr;
surface_id_allocator_ = nullptr;
@@ -245,9 +244,12 @@ void SynchronousCompositorFrameSink::SwapBuffers(cc::CompositorFrame frame) {
display_->SetSurfaceId(delegated_surface_id_,
frame.metadata.device_scale_factor);
- gfx::Size frame_size =
- frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
- display_->Resize(frame_size);
+ // This size covers the entire external clip given to DemandDrawSw(). The
+ // CompositorFrame here could be either smaller than this size (we're
+ // drawing an enlarged viewport that extends beyond the layer compositor's
+ // concept of the output size) or larger than this size (we're only drawing
+ // a portion of the layer compositor's usual output size).
+ display_->Resize(sw_display_size_for_current_draw_);
surface_factory_->SubmitCompositorFrame(
delegated_surface_id_, std::move(frame), base::Bind(&NoOpDrawCallback));
@@ -325,10 +327,13 @@ void SynchronousCompositorFrameSink::DemandDrawSw(SkCanvas* canvas) {
gfx::Transform transform(gfx::Transform::kSkipInitialization);
transform.matrix() = canvas->getTotalMatrix(); // Converts 3x3 matrix to 4x4.
+ // We will resize the Display to ensure it draws the entire |viewport| given
+ // here instead of only the layer compositor's idea of what the viewport is.
+ sw_display_size_for_current_draw_ =
+ gfx::Size(viewport.right(), viewport.bottom());
+
base::AutoReset<bool> set_in_software_draw(&in_software_draw_, true);
- display_->SetExternalViewport(viewport);
- display_->SetExternalClip(viewport);
boliu 2016/09/27 23:20:48 keep external clip apparently the assumption that
danakj 2016/09/29 22:55:52 Done.
- software_compositor_frame_sink_->SetSurfaceSize(
+ software_output_surface_->SetSurfaceSize(
gfx::SkISizeToSize(canvas->getBaseLayerSize()));
danakj 2016/09/29 22:55:52 I also removed this call, and made Reshape() store
InvokeComposite(transform, viewport);
}
« cc/surfaces/display.h ('K') | « content/renderer/android/synchronous_compositor_frame_sink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698