Commit 32dd23ef authored by kylechar's avatar kylechar Committed by Commit bot

Make exo::Surface set device_scale_factor.

exo::Surface wasn't setting the device_scale_factor in CompositorFrames.
This was triggering a DCHECK when the SurfaceInfo for new cc::Surfaces
have device_scale_factor == 0.

BUG=b/37654593

Review-Url: https://codereview.chromium.org/2843723003
Cr-Commit-Position: refs/heads/master@{#468076}
parent ce7ea8b1
...@@ -108,7 +108,9 @@ class CustomWindowDelegate : public aura::WindowDelegate { ...@@ -108,7 +108,9 @@ class CustomWindowDelegate : public aura::WindowDelegate {
bool CanFocus() override { return true; } bool CanFocus() override { return true; }
void OnCaptureLost() override {} void OnCaptureLost() override {}
void OnPaint(const ui::PaintContext& context) override {} void OnPaint(const ui::PaintContext& context) override {}
void OnDeviceScaleFactorChanged(float device_scale_factor) override {} void OnDeviceScaleFactorChanged(float device_scale_factor) override {
surface_->SetDeviceScaleFactor(device_scale_factor);
}
void OnWindowDestroying(aura::Window* window) override {} void OnWindowDestroying(aura::Window* window) override {}
void OnWindowDestroyed(aura::Window* window) override { delete this; } void OnWindowDestroyed(aura::Window* window) override { delete this; }
void OnWindowTargetVisibilityChanged(bool visible) override {} void OnWindowTargetVisibilityChanged(bool visible) override {}
...@@ -405,6 +407,10 @@ void Surface::SetAlpha(float alpha) { ...@@ -405,6 +407,10 @@ void Surface::SetAlpha(float alpha) {
pending_state_.alpha = alpha; pending_state_.alpha = alpha;
} }
void Surface::SetDeviceScaleFactor(float device_scale_factor) {
device_scale_factor_ = device_scale_factor;
}
void Surface::Commit() { void Surface::Commit() {
TRACE_EVENT0("exo", "Surface::Commit"); TRACE_EVENT0("exo", "Surface::Commit");
...@@ -847,6 +853,7 @@ void Surface::UpdateSurface(bool full_damage) { ...@@ -847,6 +853,7 @@ void Surface::UpdateSurface(bool full_damage) {
current_begin_frame_ack_.has_damage = true; current_begin_frame_ack_.has_damage = true;
} }
frame.metadata.begin_frame_ack = current_begin_frame_ack_; frame.metadata.begin_frame_ack = current_begin_frame_ack_;
frame.metadata.device_scale_factor = device_scale_factor_;
if (current_resource_.id) { if (current_resource_.id) {
// Texture quad is only needed if buffer is not fully transparent. // Texture quad is only needed if buffer is not fully transparent.
......
...@@ -140,6 +140,9 @@ class Surface : public ui::ContextFactoryObserver, ...@@ -140,6 +140,9 @@ class Surface : public ui::ContextFactoryObserver,
// This sets the alpha value that will be applied to the whole surface. // This sets the alpha value that will be applied to the whole surface.
void SetAlpha(float alpha); void SetAlpha(float alpha);
// This sets the device scale factor sent in CompositorFrames.
void SetDeviceScaleFactor(float device_scale_factor);
// Surface state (damage regions, attached buffers, etc.) is double-buffered. // Surface state (damage regions, attached buffers, etc.) is double-buffered.
// A Commit() call atomically applies all pending state, replacing the // A Commit() call atomically applies all pending state, replacing the
// current state. Commit() is not guaranteed to be synchronous. See // current state. Commit() is not guaranteed to be synchronous. See
...@@ -314,6 +317,9 @@ class Surface : public ui::ContextFactoryObserver, ...@@ -314,6 +317,9 @@ class Surface : public ui::ContextFactoryObserver,
// The buffer that will become the content of surface when Commit() is called. // The buffer that will become the content of surface when Commit() is called.
BufferAttachment pending_buffer_; BufferAttachment pending_buffer_;
// The device scale factor sent in CompositorFrames.
float device_scale_factor_ = 1.0f;
const cc::FrameSinkId frame_sink_id_; const cc::FrameSinkId frame_sink_id_;
cc::LocalSurfaceId local_surface_id_; cc::LocalSurfaceId local_surface_id_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment