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

Unified Diff: ui/views/view.cc

Issue 10221028: Move DIP translation from ui/aura to ui/compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable tests that doesn't run on bots 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ui.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 1b35ab7d892ee82a105dff660b22ad1688ad2c83..f1e33659d6f4d7bd6174a7bcfee1f0e65705520d 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -38,11 +38,6 @@
#include "ui/views/accessibility/native_view_accessibility_win.h"
#endif
-#if defined(ENABLE_DIP)
-#include "ui/gfx/monitor.h"
-#include "ui/gfx/screen.h"
-#endif
-
namespace {
// Whether to use accelerated compositing when necessary (e.g. when a view has a
@@ -85,23 +80,6 @@ const views::View* GetHierarchyRoot(const views::View* view) {
return root;
}
-// Converts the rect in DIP coordinates in DIP to pixel coordinates.
-gfx::Rect ConvertRectToPixel(const views::View* view,
- const gfx::Rect& rect_in_dip) {
-#if defined(ENABLE_DIP)
- // If we don't know in which monitor the window is in, just assume
- // it's in normal density for now.
- // TODO(oshima): Re-compute layer_'s bounds when the window is
- // attached to root window.
- if (view->GetWidget() && view->GetWidget()->GetNativeView()) {
- gfx::Monitor monitor = gfx::Screen::GetMonitorNearestWindow(
- view->GetWidget()->GetNativeView());
- return gfx::Rect(rect_in_dip.Scale(monitor.device_scale_factor()));
- }
-#endif
- return rect_in_dip;
-}
-
} // namespace
namespace views {
@@ -710,16 +688,16 @@ void View::SchedulePaint() {
SchedulePaintInRect(GetLocalBounds());
}
-void View::SchedulePaintInRect(const gfx::Rect& rect_in_dip) {
+void View::SchedulePaintInRect(const gfx::Rect& rect) {
if (!visible_ || !painting_enabled_)
return;
if (layer()) {
- layer()->SchedulePaint(ConvertRectToPixel(this, rect_in_dip));
+ layer()->SchedulePaint(rect);
} else if (parent_) {
// Translate the requested paint rect to the parent's coordinate system
// then pass this notification up to the parent.
- parent_->SchedulePaintInRect(ConvertRectToParent(rect_in_dip));
+ parent_->SchedulePaintInRect(ConvertRectToParent(rect));
}
}
@@ -1257,17 +1235,6 @@ void View::UpdateChildLayerBounds(const gfx::Point& offset) {
}
void View::OnPaintLayer(gfx::Canvas* canvas) {
-#if defined(ENABLE_DIP)
- scoped_ptr<ScopedCanvas> scoped_canvas;
- if (layer() && GetWidget() && GetWidget()->GetNativeView()) {
- scoped_canvas.reset(new ScopedCanvas(canvas));
- float scale =
- gfx::Screen::GetMonitorNearestWindow(GetWidget()->GetNativeView()).
- device_scale_factor();
- canvas->sk_canvas()->scale(SkFloatToScalar(scale), SkFloatToScalar(scale));
- }
-#endif
-
if (!layer() || !layer()->fills_bounds_opaquely())
canvas->DrawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
PaintCommon(canvas);
@@ -1768,8 +1735,8 @@ void View::RemoveDescendantToNotify(View* view) {
descendants_to_notify_.reset();
}
-void View::SetLayerBounds(const gfx::Rect& bounds_in_dip) {
- layer()->SetBounds(ConvertRectToPixel(this, bounds_in_dip));
+void View::SetLayerBounds(const gfx::Rect& bounds) {
+ layer()->SetBounds(bounds);
}
// Transformations -------------------------------------------------------------
« no previous file with comments | « ui/ui.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698