summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-22 17:33:30 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-22 17:33:30 +0000
commit7efa5fbd4d8cea3d2b4abd1ed1e958a40fa21d88 (patch)
tree6d1b39d27bf6020e6f066a30437678999f045935 /ui
parentb9305cabd8881f812af49d8b6fa715f97b93e5a1 (diff)
downloadchromium_src-7efa5fbd4d8cea3d2b4abd1ed1e958a40fa21d88.zip
chromium_src-7efa5fbd4d8cea3d2b4abd1ed1e958a40fa21d88.tar.gz
chromium_src-7efa5fbd4d8cea3d2b4abd1ed1e958a40fa21d88.tar.bz2
Fix a couple of bugs with the image skia implementation
Bug=124566 Test=Manual Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=137684 Review URL: https://chromiumcodereview.appspot.com/10389109 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/base/resource/resource_bundle.cc11
-rw-r--r--ui/gfx/screen.h3
-rw-r--r--ui/gfx/screen_android.cc5
-rw-r--r--ui/gfx/screen_aura.cc5
-rw-r--r--ui/gfx/screen_gtk.cc5
-rw-r--r--ui/gfx/screen_mac.mm5
-rw-r--r--ui/gfx/screen_win.cc5
7 files changed, 34 insertions, 5 deletions
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
index c5fa973..524abaf 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -25,6 +25,7 @@
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/screen.h"
namespace ui {
@@ -236,11 +237,11 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
for (size_t i = 0; i < data_packs_.size(); ++i) {
scoped_ptr<SkBitmap> bitmap(LoadBitmap(*data_packs_[i], resource_id));
if (bitmap.get()) {
-#if defined(USE_AURA)
- image_skia.AddBitmapForScale(*bitmap, data_packs_[i]->GetScaleFactor());
-#else
- image_skia.AddBitmapForScale(*bitmap, 1.0f);
-#endif
+ if (gfx::Screen::IsDIPEnabled())
+ image_skia.AddBitmapForScale(*bitmap,
+ data_packs_[i]->GetScaleFactor());
+ else
+ image_skia.AddBitmapForScale(*bitmap, 1.0f);
}
}
diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h
index f0f4201..286ef94 100644
--- a/ui/gfx/screen.h
+++ b/ui/gfx/screen.h
@@ -28,6 +28,9 @@ class UI_EXPORT Screen {
static void SetInstance(ScreenImpl* screen);
#endif
+ // Returns true if DIP is enabled.
+ static bool IsDIPEnabled();
+
// Returns the current absolute position of the mouse pointer.
static gfx::Point GetCursorScreenPoint();
diff --git a/ui/gfx/screen_android.cc b/ui/gfx/screen_android.cc
index 54c2000..cbeb6c7 100644
--- a/ui/gfx/screen_android.cc
+++ b/ui/gfx/screen_android.cc
@@ -10,6 +10,11 @@
namespace gfx {
// static
+bool Screen::IsDIPEnabled() {
+ return false;
+}
+
+// static
gfx::Monitor Screen::GetPrimaryMonitor() {
NOTIMPLEMENTED() << "crbug.com/117839 tracks implementation";
return gfx::Monitor(0, gfx::Rect(0, 0, 1, 1));
diff --git a/ui/gfx/screen_aura.cc b/ui/gfx/screen_aura.cc
index 4337ede..7341a0e 100644
--- a/ui/gfx/screen_aura.cc
+++ b/ui/gfx/screen_aura.cc
@@ -27,6 +27,11 @@ void Screen::SetInstance(ScreenImpl* screen) {
// ifdef.
// static
+bool Screen::IsDIPEnabled() {
+ return true;
+}
+
+// static
Point Screen::GetCursorScreenPoint() {
return g_instance_->GetCursorScreenPoint();
}
diff --git a/ui/gfx/screen_gtk.cc b/ui/gfx/screen_gtk.cc
index 3de2d3e..4df13b6 100644
--- a/ui/gfx/screen_gtk.cc
+++ b/ui/gfx/screen_gtk.cc
@@ -76,6 +76,11 @@ gfx::Rect GetMonitorAreaNearestWindow(gfx::NativeView view) {
namespace gfx {
// static
+bool Screen::IsDIPEnabled() {
+ return false;
+}
+
+// static
gfx::Point Screen::GetCursorScreenPoint() {
gint x, y;
gdk_display_get_pointer(gdk_display_get_default(), NULL, &x, &y, NULL);
diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm
index ef66ff4..0bbed90 100644
--- a/ui/gfx/screen_mac.mm
+++ b/ui/gfx/screen_mac.mm
@@ -75,6 +75,11 @@ gfx::Monitor GetMonitorForScreen(NSScreen* screen, bool is_primary) {
namespace gfx {
// static
+bool Screen::IsDIPEnabled() {
+ return false;
+}
+
+// static
gfx::Point Screen::GetCursorScreenPoint() {
NSPoint mouseLocation = [NSEvent mouseLocation];
// Flip coordinates to gfx (0,0 in top-left corner) using primary screen.
diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc
index 4487c61..3ded451 100644
--- a/ui/gfx/screen_win.cc
+++ b/ui/gfx/screen_win.cc
@@ -30,6 +30,11 @@ gfx::Monitor GetMonitor(MONITORINFO& monitor_info) {
namespace gfx {
// static
+bool Screen::IsDIPEnabled() {
+ return false;
+}
+
+// static
gfx::Point Screen::GetCursorScreenPoint() {
POINT pt;
GetCursorPos(&pt);