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

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 1247813002: Honor --force-device-scale-factor when converting point in gfx::Screen on linux aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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 "chrome/browser/ui/libgtk2ui/gtk2_ui.h" 5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 9
10 #include <pango/pango.h> 10 #include <pango/pango.h>
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h" 38 #include "chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h"
39 #include "grit/components_scaled_resources.h" 39 #include "grit/components_scaled_resources.h"
40 #include "grit/theme_resources.h" 40 #include "grit/theme_resources.h"
41 #include "printing/printing_context_linux.h" 41 #include "printing/printing_context_linux.h"
42 #include "third_party/skia/include/core/SkBitmap.h" 42 #include "third_party/skia/include/core/SkBitmap.h"
43 #include "third_party/skia/include/core/SkCanvas.h" 43 #include "third_party/skia/include/core/SkCanvas.h"
44 #include "third_party/skia/include/core/SkColor.h" 44 #include "third_party/skia/include/core/SkColor.h"
45 #include "third_party/skia/include/core/SkShader.h" 45 #include "third_party/skia/include/core/SkShader.h"
46 #include "ui/base/resource/resource_bundle.h" 46 #include "ui/base/resource/resource_bundle.h"
47 #include "ui/gfx/canvas.h" 47 #include "ui/gfx/canvas.h"
48 #include "ui/gfx/display.h"
48 #include "ui/gfx/geometry/rect.h" 49 #include "ui/gfx/geometry/rect.h"
49 #include "ui/gfx/geometry/size.h" 50 #include "ui/gfx/geometry/size.h"
50 #include "ui/gfx/image/image.h" 51 #include "ui/gfx/image/image.h"
51 #include "ui/gfx/skbitmap_operations.h" 52 #include "ui/gfx/skbitmap_operations.h"
52 #include "ui/gfx/skia_util.h" 53 #include "ui/gfx/skia_util.h"
53 #include "ui/gfx/x/x11_types.h" 54 #include "ui/gfx/x/x11_types.h"
54 #include "ui/resources/grit/ui_resources.h" 55 #include "ui/resources/grit/ui_resources.h"
55 #include "ui/views/controls/button/label_button.h" 56 #include "ui/views/controls/button/label_button.h"
56 #include "ui/views/controls/button/label_button_border.h" 57 #include "ui/views/controls/button/label_button_border.h"
57 #include "ui/views/linux_ui/window_button_order_observer.h" 58 #include "ui/views/linux_ui/window_button_order_observer.h"
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 NativeThemeGtk2::instance()->NotifyObservers(); 1428 NativeThemeGtk2::instance()->NotifyObservers();
1428 } 1429 }
1429 1430
1430 void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) { 1431 void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) {
1431 device_scale_factor_ = device_scale_factor; 1432 device_scale_factor_ = device_scale_factor;
1432 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get()); 1433 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get());
1433 UpdateDefaultFont(label_style->font_desc); 1434 UpdateDefaultFont(label_style->font_desc);
1434 } 1435 }
1435 1436
1436 float Gtk2UI::GetDeviceScaleFactor() const { 1437 float Gtk2UI::GetDeviceScaleFactor() const {
1438 if (gfx::Display::HasForceDeviceScaleFactor())
1439 return gfx::Display::GetForcedDeviceScaleFactor();
1437 float scale = GetFontDPI() / GetBaseDPI(); 1440 float scale = GetFontDPI() / GetBaseDPI();
1438 // Round to 1 decimal, e.g. to 1.4. 1441 // Round to 1 decimal, e.g. to 1.4.
1439 return roundf(scale * 10) / 10; 1442 return roundf(scale * 10) / 10;
1440 } 1443 }
1441 1444
1442 } // namespace libgtk2ui 1445 } // namespace libgtk2ui
1443 1446
1444 views::LinuxUI* BuildGtk2UI() { 1447 views::LinuxUI* BuildGtk2UI() {
1445 return new libgtk2ui::Gtk2UI; 1448 return new libgtk2ui::Gtk2UI;
1446 } 1449 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698