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)); |