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

Unified Diff: cc/surfaces/display.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « cc/surfaces/display.h ('k') | cc/surfaces/surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/display.cc
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc
index a8ae27a6055f63c6b7f366c38881c4ec49435ae9..9257446a2eb8e96f793beb6a93467ff0b355e06a 100644
--- a/cc/surfaces/display.cc
+++ b/cc/surfaces/display.cc
@@ -49,15 +49,23 @@ bool Display::Initialize(scoped_ptr<OutputSurface> output_surface) {
return output_surface_->BindToClient(this);
}
-void Display::Resize(SurfaceId id,
- const gfx::Size& size,
- float device_scale_factor) {
+void Display::SetSurfaceId(SurfaceId id, float device_scale_factor) {
current_surface_id_ = id;
- current_surface_size_ = size;
device_scale_factor_ = device_scale_factor;
client_->DisplayDamaged();
}
+void Display::Resize(const gfx::Size& size) {
+ if (size == current_surface_size_)
+ return;
+ // Need to ensure all pending swaps have executed before the window is
+ // resized, or D3D11 will scale the swap output.
+ if (renderer_ && settings_.finish_rendering_on_resize)
+ renderer_->Finish();
+ current_surface_size_ = size;
+ client_->DisplayDamaged();
+}
+
void Display::InitializeRenderer() {
if (resource_provider_)
return;
@@ -112,6 +120,9 @@ bool Display::Draw() {
benchmark_instrumentation::IssueDisplayRenderingStatsEvent();
DelegatedFrameData* frame_data = frame->delegated_frame_data.get();
+ gfx::Size surface_size =
+ frame_data->render_pass_list.back()->output_rect.size();
+
gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_);
gfx::Rect device_clip_rect = device_viewport_rect;
bool disable_picture_quad_image_filtering = false;
@@ -122,7 +133,14 @@ bool Display::Draw() {
device_viewport_rect,
device_clip_rect,
disable_picture_quad_image_filtering);
- renderer_->SwapBuffers(frame->metadata);
+
+ bool disable_swap = surface_size != current_surface_size_;
+ if (disable_swap) {
+ DidSwapBuffers();
+ } else {
+ renderer_->SwapBuffers(frame->metadata);
+ }
+
for (SurfaceAggregator::SurfaceIndexMap::iterator it =
aggregator_->previous_contained_surfaces().begin();
it != aggregator_->previous_contained_surfaces().end();
@@ -131,6 +149,8 @@ bool Display::Draw() {
if (surface)
surface->RunDrawCallbacks();
}
+ if (disable_swap)
+ DidSwapBuffersComplete();
return true;
}
« no previous file with comments | « cc/surfaces/display.h ('k') | cc/surfaces/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698