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

Side by Side Diff: ui/compositor/layer.cc

Issue 10391165: Notification for device scale factor change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: demo_main fix Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/window_delegate.h ('k') | ui/compositor/layer_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 } 370 }
371 371
372 void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) { 372 void Layer::OnDeviceScaleFactorChanged(float device_scale_factor) {
373 CHECK(IsDIPEnabled()); 373 CHECK(IsDIPEnabled());
374 if (device_scale_factor_ == device_scale_factor) 374 if (device_scale_factor_ == device_scale_factor)
375 return; 375 return;
376 device_scale_factor_ = device_scale_factor; 376 device_scale_factor_ = device_scale_factor;
377 RecomputeTransform(); 377 RecomputeTransform();
378 RecomputeDrawsContentAndUVRect(); 378 RecomputeDrawsContentAndUVRect();
379 SchedulePaint(gfx::Rect(bounds_.size())); 379 SchedulePaint(gfx::Rect(bounds_.size()));
380 if (delegate_)
381 delegate_->OnDeviceScaleFactorChanged(device_scale_factor);
380 for (size_t i = 0; i < children_.size(); ++i) 382 for (size_t i = 0; i < children_.size(); ++i)
381 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); 383 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor);
382 } 384 }
383 385
384 void Layer::paintContents(WebKit::WebCanvas* web_canvas, 386 void Layer::paintContents(WebKit::WebCanvas* web_canvas,
385 const WebKit::WebRect& clip) { 387 const WebKit::WebRect& clip) {
386 TRACE_EVENT0("ui", "Layer::paintContents"); 388 TRACE_EVENT0("ui", "Layer::paintContents");
387 gfx::Canvas canvas(web_canvas); 389 gfx::Canvas canvas(web_canvas);
388 bool scale_canvas = IsDIPEnabled() && scale_canvas_; 390 bool scale_canvas = IsDIPEnabled() && scale_canvas_;
389 if (scale_canvas) { 391 if (scale_canvas) {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 return; 620 return;
619 unsigned int color = 0xFF000000; 621 unsigned int color = 0xFF000000;
620 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 622 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
621 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 623 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
622 if (!opaque) 624 if (!opaque)
623 color |= 0xFF; 625 color |= 0xFF;
624 web_layer_.setDebugBorderColor(color); 626 web_layer_.setDebugBorderColor(color);
625 } 627 }
626 628
627 } // namespace ui 629 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/window_delegate.h ('k') | ui/compositor/layer_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698