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

Side by Side Diff: chrome/browser/chromeos/display/overscan_calibrator.cc

Issue 11195036: Overscan calibration UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/display/overscan_calibrator.h"
6
7 #include "ash/display/display_controller.h"
8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h"
10 #include "base/callback.h"
11 #include "chrome/browser/chromeos/display/display_preferences.h"
12 #include "ui/aura/window.h"
13 #include "ui/compositor/layer.h"
14 #include "ui/gfx/canvas.h"
15
16 namespace chromeos {
17
18 OverscanCalibrator::OverscanCalibrator(
19 const gfx::Display& target_display, const gfx::Insets& initial_insets)
20 : display_(target_display), insets_(initial_insets) {
21 aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()->
22 GetRootWindowForDisplayId(display_.id());
23 ui::Layer* parent_layer = ash::Shell::GetContainer(
24 root, ash::internal::kShellWindowId_OverlayContainer)->layer();
25
26 calibration_layer_.reset(new ui::Layer());
27 calibration_layer_->SetOpacity(0.5f);
28 calibration_layer_->SetBounds(parent_layer->bounds());
29 calibration_layer_->set_delegate(this);
30 parent_layer->Add(calibration_layer_.get());
31 inner_bounds_ = parent_layer->bounds();
32 }
33
34 OverscanCalibrator::~OverscanCalibrator() {
35 }
36
37 void OverscanCalibrator::Finish() {
38 calibration_layer_.reset();
39 }
40
41 void OverscanCalibrator::Commit() {
42 SetDisplayOverscan(display_, insets_);
43 }
44
45 void OverscanCalibrator::UpdateInsets(const gfx::Insets& insets) {
46 inner_bounds_.Inset(insets_.Scale(-1));
47 inner_bounds_.Inset(insets);
oshima 2012/10/19 19:36:11 Why this is necessary? Can you add comment?
Jun Mukai 2012/10/19 21:39:34 added.
48 insets_ = insets;
49 calibration_layer_->SchedulePaint(calibration_layer_->bounds());
50 }
51
52 void OverscanCalibrator::OnPaintLayer(gfx::Canvas* canvas) {
53 canvas->FillRect(calibration_layer_->bounds(), SK_ColorBLACK);
54 const SkColor transparent = SkColorSetARGB(0, 0, 0, 0);
oshima 2012/10/19 19:36:11 static const and move to the beginning I actually
Jun Mukai 2012/10/19 21:39:34 done for static const. I'll ask piman, thanks.
Jun Mukai 2012/10/19 22:18:12 Just for recording: I asked piman for this, but no
55 canvas->FillRect(inner_bounds_, transparent, SkXfermode::kClear_Mode);
56 }
57
58 void OverscanCalibrator::OnDeviceScaleFactorChanged(
59 float device_scale_factor) {
oshima 2012/10/19 19:36:11 We probably should cancel the operation when displ
Jun Mukai 2012/10/19 21:39:34 added TODO.
60 }
61
62 base::Closure OverscanCalibrator::PrepareForLayerBoundsChange() {
63 return base::Closure();
64 }
65
66 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698