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

Unified Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 11081007: Remove implicit flooring Scale() method from Point and Size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try -b win_rel,mac_rel,linux_rel,linux_aura 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/tab_contents/thumbnail_generator.cc
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc
index 09ce31ac785b45f036c4a5c25e822216b662a5bf..d1a4a4267566cb941f5b6ce7b45f3928da13e0ba 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc
@@ -31,6 +31,7 @@
#include "ui/base/layout.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/rect.h"
+#include "ui/gfx/size_conversions.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/scrollbar_size.h"
#include "ui/gfx/skbitmap_operations.h"
@@ -107,8 +108,8 @@ gfx::Size GetCopySizeForThumbnail(content::RenderWidgetHostView* view) {
ui::GetScaleFactorForNativeView(view->GetNativeView());
switch (scale_factor) {
case ui::SCALE_FACTOR_100P:
- copy_size =
- copy_size.Scale(ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P));
+ copy_size = gfx::ToFlooredSize(
+ copy_size.Scale(ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P)));
break;
case ui::SCALE_FACTOR_200P:
// Use the size as-is.
@@ -116,8 +117,8 @@ gfx::Size GetCopySizeForThumbnail(content::RenderWidgetHostView* view) {
default:
DLOG(WARNING) << "Unsupported scale factor. Use the same copy size as "
<< "ui::SCALE_FACTOR_100P";
- copy_size =
- copy_size.Scale(ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P));
+ copy_size = gfx::ToFlooredSize(
+ copy_size.Scale(ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P)));
break;
}
return copy_size;
@@ -129,7 +130,8 @@ gfx::Size GetThumbnailSizeInPixel() {
// Determine the resolution of the thumbnail based on the primary monitor.
// TODO(oshima): Use device's default scale factor.
gfx::Display primary_display = gfx::Screen::GetPrimaryDisplay();
- return thumbnail_size.Scale(primary_display.device_scale_factor());
+ return gfx::ToFlooredSize(
+ thumbnail_size.Scale(primary_display.device_scale_factor()));
}
// Returns the clipping rectangle that is used for creating a thumbnail with
@@ -311,7 +313,8 @@ void ThumbnailGenerator::AskForSnapshot(RenderWidgetHost* renderer,
sequence_num++;
float scale_factor = ui::GetScaleFactorScale(ui::GetScaleFactorForNativeView(
renderer->GetView()->GetNativeView()));
- gfx::Size desired_size_in_pixel = desired_size.Scale(scale_factor);
+ gfx::Size desired_size_in_pixel = gfx::ToFlooredSize(
+ desired_size.Scale(scale_factor));
scoped_ptr<TransportDIB> thumbnail_dib(TransportDIB::Create(
desired_size_in_pixel.GetArea() * 4, sequence_num));

Powered by Google App Engine
This is Rietveld 408576698