OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/thumbnails/simple_thumbnail_crop.h" | 5 #include "chrome/browser/thumbnails/simple_thumbnail_crop.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "skia/ext/platform_canvas.h" | 9 #include "skia/ext/platform_canvas.h" |
10 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 copy_size = gfx::ToFlooredSize(gfx::ScaleSize( | 123 copy_size = gfx::ToFlooredSize(gfx::ScaleSize( |
124 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P))); | 124 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P))); |
125 break; | 125 break; |
126 case ui::SCALE_FACTOR_200P: | 126 case ui::SCALE_FACTOR_200P: |
127 // Use the size as-is. | 127 // Use the size as-is. |
128 break; | 128 break; |
129 default: | 129 default: |
130 DLOG(WARNING) << "Unsupported scale factor. Use the same copy size as " | 130 DLOG(WARNING) << "Unsupported scale factor. Use the same copy size as " |
131 << "ui::SCALE_FACTOR_100P"; | 131 << "ui::SCALE_FACTOR_100P"; |
132 copy_size = gfx::ToFlooredSize(gfx::ScaleSize( | 132 copy_size = gfx::ToFlooredSize(gfx::ScaleSize( |
133 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P))); | 133 copy_size, ui::GetMaxScaleFactor())); |
134 break; | 134 break; |
135 } | 135 } |
136 return copy_size; | 136 return copy_size; |
137 } | 137 } |
138 | 138 |
139 gfx::Rect SimpleThumbnailCrop::GetClippingRect(const gfx::Size& source_size, | 139 gfx::Rect SimpleThumbnailCrop::GetClippingRect(const gfx::Size& source_size, |
140 const gfx::Size& desired_size, | 140 const gfx::Size& desired_size, |
141 ClipResult* clip_result) { | 141 ClipResult* clip_result) { |
142 DCHECK(clip_result); | 142 DCHECK(clip_result); |
143 | 143 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 if (clipped_bitmap.width() == result.width() && | 237 if (clipped_bitmap.width() == result.width() && |
238 clipped_bitmap.height() == result.height()) | 238 clipped_bitmap.height() == result.height()) |
239 clipped_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); | 239 clipped_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); |
240 #endif | 240 #endif |
241 | 241 |
242 HISTOGRAM_TIMES(kThumbnailHistogramName, | 242 HISTOGRAM_TIMES(kThumbnailHistogramName, |
243 base::TimeTicks::Now() - begin_compute_thumbnail); | 243 base::TimeTicks::Now() - begin_compute_thumbnail); |
244 return result; | 244 return result; |
245 } | 245 } |
246 | 246 |
247 } | 247 } // namespace thumbnails |
OLD | NEW |