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

Unified Diff: cc/surfaces/surface.cc

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface.cc
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 2ceae59329081c2295c5aadac3d04fb171d0742e..14846ec7c14e60e1c7dac5e500500eefc9b0d3e9 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -23,9 +23,9 @@ namespace cc {
// completely damaged the first time they're drawn from.
static const int kFrameIndexStart = 2;
-Surface::Surface(const SurfaceId& id, base::WeakPtr<SurfaceFactory> factory)
- : surface_id_(id),
- previous_frame_surface_id_(id),
+Surface::Surface(const SurfaceInfo& info, base::WeakPtr<SurfaceFactory> factory)
+ : surface_info_(info),
+ previous_frame_surface_id_(info.id()),
factory_(factory),
frame_index_(kFrameIndexStart),
destroyed_(false) {}
@@ -53,6 +53,16 @@ void Surface::SetPreviousFrameSurface(Surface* surface) {
void Surface::QueueFrame(CompositorFrame frame,
const DrawCallback& callback,
const WillDrawCallback& will_draw_callback) {
+ if (!frame.render_pass_list.empty()) {
Fady Samuel 2017/05/07 18:16:51 Not necessary any more right?
Saman Sami 2017/05/08 20:40:32 Done.
+ gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
+ float device_scale_factor = frame.metadata.device_scale_factor;
+ if (frame_size != surface_info_.size_in_pixels() ||
+ device_scale_factor != surface_info_.device_scale_factor()) {
Fady Samuel 2017/05/01 20:36:54 Return resources and call the callback too.
Fady Samuel 2017/05/07 18:16:51 I'd love to move this test into a common place bec
Saman Sami 2017/05/08 20:40:32 That'll be nice, yes.
Saman Sami 2017/05/16 18:55:46 Actually, I'm not sure how much that will help. I
+ DLOG(ERROR) << "Frame size doesn't match surface size.";
+ return;
+ }
+ }
+
TakeLatencyInfoFromPendingFrame(&frame.metadata.latency_info);
base::Optional<FrameData> previous_pending_frame_data =
@@ -287,7 +297,7 @@ void Surface::RunWillDrawCallback(const gfx::Rect& damage_rect) {
if (!active_frame_data_ || active_frame_data_->will_draw_callback.is_null())
return;
- active_frame_data_->will_draw_callback.Run(surface_id_.local_surface_id(),
+ active_frame_data_->will_draw_callback.Run(surface_id().local_surface_id(),
damage_rect);
}
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698