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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 copy_size = gfx::ToFlooredSize(gfx::ScaleSize( | 121 copy_size = gfx::ToFlooredSize(gfx::ScaleSize( |
122 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P))); | 122 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P))); |
123 break; | 123 break; |
124 case ui::SCALE_FACTOR_200P: | 124 case ui::SCALE_FACTOR_200P: |
125 // Use the size as-is. | 125 // Use the size as-is. |
126 break; | 126 break; |
127 default: | 127 default: |
128 DLOG(WARNING) << "Unsupported scale factor. Use the same copy size as " | 128 DLOG(WARNING) << "Unsupported scale factor. Use the same copy size as " |
129 << "ui::SCALE_FACTOR_100P"; | 129 << "ui::SCALE_FACTOR_100P"; |
130 copy_size = gfx::ToFlooredSize(gfx::ScaleSize( | 130 copy_size = gfx::ToFlooredSize(gfx::ScaleSize( |
131 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P))); | 131 copy_size, ui::GetMaxScaleFactor())); |
132 break; | 132 break; |
133 } | 133 } |
134 return copy_size; | 134 return copy_size; |
135 } | 135 } |
136 | 136 |
137 SimpleThumbnailCrop::~SimpleThumbnailCrop() { | 137 SimpleThumbnailCrop::~SimpleThumbnailCrop() { |
138 } | 138 } |
139 | 139 |
140 // Returns the size of the thumbnail stored in the database in pixel. | 140 // Returns the size of the thumbnail stored in the database in pixel. |
141 gfx::Size SimpleThumbnailCrop::GetThumbnailSizeInPixel() const { | 141 gfx::Size SimpleThumbnailCrop::GetThumbnailSizeInPixel() const { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 clipped_bitmap.height() == result.height()) | 237 clipped_bitmap.height() == result.height()) |
238 clipped_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); | 238 clipped_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); |
239 #endif | 239 #endif |
240 | 240 |
241 HISTOGRAM_TIMES(kThumbnailHistogramName, | 241 HISTOGRAM_TIMES(kThumbnailHistogramName, |
242 base::TimeTicks::Now() - begin_compute_thumbnail); | 242 base::TimeTicks::Now() - begin_compute_thumbnail); |
243 return result; | 243 return result; |
244 } | 244 } |
245 | 245 |
246 } | 246 } |
OLD | NEW |