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 #if defined(HIGHDPI) | |
132 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_140P))); | |
kevers
2013/06/03 17:28:50
ui::GetMaxScaleFactor() in place of the if-else?
girard
2013/06/03 22:31:55
Good idea. Done.
| |
133 #else | |
131 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P))); | 134 copy_size, ui::GetScaleFactorScale(ui::SCALE_FACTOR_200P))); |
135 #endif | |
132 break; | 136 break; |
133 } | 137 } |
134 return copy_size; | 138 return copy_size; |
135 } | 139 } |
136 | 140 |
137 SimpleThumbnailCrop::~SimpleThumbnailCrop() { | 141 SimpleThumbnailCrop::~SimpleThumbnailCrop() { |
138 } | 142 } |
139 | 143 |
140 // Returns the size of the thumbnail stored in the database in pixel. | 144 // Returns the size of the thumbnail stored in the database in pixel. |
141 gfx::Size SimpleThumbnailCrop::GetThumbnailSizeInPixel() const { | 145 gfx::Size SimpleThumbnailCrop::GetThumbnailSizeInPixel() const { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 clipped_bitmap.height() == result.height()) | 241 clipped_bitmap.height() == result.height()) |
238 clipped_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); | 242 clipped_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); |
239 #endif | 243 #endif |
240 | 244 |
241 HISTOGRAM_TIMES(kThumbnailHistogramName, | 245 HISTOGRAM_TIMES(kThumbnailHistogramName, |
242 base::TimeTicks::Now() - begin_compute_thumbnail); | 246 base::TimeTicks::Now() - begin_compute_thumbnail); |
243 return result; | 247 return result; |
244 } | 248 } |
245 | 249 |
246 } | 250 } |
OLD | NEW |