diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 03:33:38 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 03:33:38 +0000 |
commit | 55a44a840df93909d26134d21b68e994222223b2 (patch) | |
tree | 2d0302e824cd4581c02a7b3ab8c9e0bb20cdd105 /ui | |
parent | 201a786fd066fec58b2a378537159fb8cfcc9e20 (diff) | |
download | chromium_src-55a44a840df93909d26134d21b68e994222223b2.zip chromium_src-55a44a840df93909d26134d21b68e994222223b2.tar.gz chromium_src-55a44a840df93909d26134d21b68e994222223b2.tar.bz2 |
Revert 137622 - Fix a couple of bugs with the image skia implementation
Bug=124566
Test=Manual
Review URL: https://chromiumcodereview.appspot.com/10389109
TBR=pkotwicz@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10391179
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137625 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/resource/resource_bundle.cc | 11 | ||||
-rw-r--r-- | ui/gfx/image/image_skia.cc | 13 | ||||
-rw-r--r-- | ui/gfx/screen.h | 3 | ||||
-rw-r--r-- | ui/gfx/screen_android.cc | 5 | ||||
-rw-r--r-- | ui/gfx/screen_aura.cc | 6 | ||||
-rw-r--r-- | ui/gfx/screen_gtk.cc | 5 | ||||
-rw-r--r-- | ui/gfx/screen_mac.mm | 5 | ||||
-rw-r--r-- | ui/gfx/screen_win.cc | 5 |
8 files changed, 14 insertions, 39 deletions
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 524abaf..9de5a4f 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -25,7 +25,6 @@ #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 { @@ -237,11 +236,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 (gfx::Screen::IsDIPEnabled()) - image_skia.AddBitmapForScale(*bitmap, - data_packs_[i]->GetScaleFactor()); - else - image_skia.AddBitmapForScale(*bitmap, 1.0f); +#if defined(ENABLE_DIP) + image_skia.AddBitmapForScale(*bitmap, data_packs_[i]->GetScaleFactor()); +#else + image_skia.AddBitmapForScale(*bitmap, 1.0f); +#endif } } diff --git a/ui/gfx/image/image_skia.cc b/ui/gfx/image/image_skia.cc index 1c65c0f..21fb659 100644 --- a/ui/gfx/image/image_skia.cc +++ b/ui/gfx/image/image_skia.cc @@ -91,10 +91,15 @@ void ImageSkia::AddBitmapForScale(const SkBitmap& bitmap, if (isNull()) { Init(bitmap, dip_scale_factor); } else { - // Currently data packs include 1x scale images whenever a different scale - // image is unavailable. As |dip_scale_factor| is derived from the data - // pack, sometimes |dip_scale_factor| is incorrect. - // TODO(pkotwicz): Fix this and add DCHECK. + // We currently assume that the bitmap size = 1x size * |dip_scale_factor|. + // TODO(pkotwicz): Do something better because of rounding errors when + // |dip_scale_factor| is not an int. + // TODO(pkotwicz): Remove DCHECK for dip_scale_factor == 1.0f once + // image_loading_tracker correctly handles multiple sized images. + DCHECK(dip_scale_factor == 1.0f || + static_cast<int>(width() * dip_scale_factor) == bitmap.width()); + DCHECK(dip_scale_factor == 1.0f || + static_cast<int>(height() * dip_scale_factor) == bitmap.height()); storage_->AddBitmap(bitmap); } } diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h index d6eb629..f0f4201 100644 --- a/ui/gfx/screen.h +++ b/ui/gfx/screen.h @@ -28,9 +28,6 @@ class UI_EXPORT Screen { static void SetInstance(ScreenImpl* screen); #endif - // 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 cbeb6c7..54c2000 100644 --- a/ui/gfx/screen_android.cc +++ b/ui/gfx/screen_android.cc @@ -10,11 +10,6 @@ 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 35efac8..4337ede 100644 --- a/ui/gfx/screen_aura.cc +++ b/ui/gfx/screen_aura.cc @@ -5,7 +5,6 @@ #include "ui/gfx/screen.h" #include "base/logging.h" -#include "ui/compositor/dip_util.h" #include "ui/gfx/monitor.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/screen_impl.h" @@ -28,11 +27,6 @@ void Screen::SetInstance(ScreenImpl* screen) { // ifdef. // static -bool Screen::IsDIPEnabled() { - return ui::IsDIPEnabled(); -} - -// static Point Screen::GetCursorScreenPoint() { return g_instance_->GetCursorScreenPoint(); } diff --git a/ui/gfx/screen_gtk.cc b/ui/gfx/screen_gtk.cc index 4df13b6..3de2d3e 100644 --- a/ui/gfx/screen_gtk.cc +++ b/ui/gfx/screen_gtk.cc @@ -76,11 +76,6 @@ 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 0bbed90..ef66ff4 100644 --- a/ui/gfx/screen_mac.mm +++ b/ui/gfx/screen_mac.mm @@ -75,11 +75,6 @@ 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 3ded451..4487c61 100644 --- a/ui/gfx/screen_win.cc +++ b/ui/gfx/screen_win.cc @@ -30,11 +30,6 @@ gfx::Monitor GetMonitor(MONITORINFO& monitor_info) { namespace gfx { // static -bool Screen::IsDIPEnabled() { - return false; -} - -// static gfx::Point Screen::GetCursorScreenPoint() { POINT pt; GetCursorPos(&pt); |