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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/display/overscan_calibrator.cc
diff --git a/chrome/browser/chromeos/display/overscan_calibrator.cc b/chrome/browser/chromeos/display/overscan_calibrator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4714ed7ed1a019f483bf5375b9d13a3e9253a6a4
--- /dev/null
+++ b/chrome/browser/chromeos/display/overscan_calibrator.cc
@@ -0,0 +1,66 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/display/overscan_calibrator.h"
+
+#include "ash/display/display_controller.h"
+#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
+#include "base/callback.h"
+#include "chrome/browser/chromeos/display/display_preferences.h"
+#include "ui/aura/window.h"
+#include "ui/compositor/layer.h"
+#include "ui/gfx/canvas.h"
+
+namespace chromeos {
+
+OverscanCalibrator::OverscanCalibrator(
+ const gfx::Display& target_display, const gfx::Insets& initial_insets)
+ : display_(target_display), insets_(initial_insets) {
+ aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()->
+ GetRootWindowForDisplayId(display_.id());
+ ui::Layer* parent_layer = ash::Shell::GetContainer(
+ root, ash::internal::kShellWindowId_OverlayContainer)->layer();
+
+ calibration_layer_.reset(new ui::Layer());
+ calibration_layer_->SetOpacity(0.5f);
+ calibration_layer_->SetBounds(parent_layer->bounds());
+ calibration_layer_->set_delegate(this);
+ parent_layer->Add(calibration_layer_.get());
+ inner_bounds_ = parent_layer->bounds();
+}
+
+OverscanCalibrator::~OverscanCalibrator() {
+}
+
+void OverscanCalibrator::Finish() {
+ calibration_layer_.reset();
+}
+
+void OverscanCalibrator::Commit() {
+ SetDisplayOverscan(display_, insets_);
+}
+
+void OverscanCalibrator::UpdateInsets(const gfx::Insets& insets) {
+ inner_bounds_.Inset(insets_.Scale(-1));
+ 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.
+ insets_ = insets;
+ calibration_layer_->SchedulePaint(calibration_layer_->bounds());
+}
+
+void OverscanCalibrator::OnPaintLayer(gfx::Canvas* canvas) {
+ canvas->FillRect(calibration_layer_->bounds(), SK_ColorBLACK);
+ 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
+ canvas->FillRect(inner_bounds_, transparent, SkXfermode::kClear_Mode);
+}
+
+void OverscanCalibrator::OnDeviceScaleFactorChanged(
+ 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.
+}
+
+base::Closure OverscanCalibrator::PrepareForLayerBoundsChange() {
+ return base::Closure();
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698