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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
11 #include "skia/ext/platform_canvas.h" | 11 #include "skia/ext/platform_canvas.h" |
12 #include "ui/base/layout.h" | 12 #include "ui/base/layout.h" |
13 #include "ui/gfx/color_utils.h" | 13 #include "ui/gfx/color_utils.h" |
14 #include "ui/gfx/geometry/size_conversions.h" | 14 #include "ui/gfx/geometry/size_conversions.h" |
15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
16 #include "ui/gfx/screen.h" | |
17 #include "ui/gfx/scrollbar_size.h" | 16 #include "ui/gfx/scrollbar_size.h" |
18 #include "ui/gfx/skbitmap_operations.h" | 17 #include "ui/gfx/skbitmap_operations.h" |
19 | 18 |
20 namespace { | 19 namespace { |
21 static const char kThumbnailHistogramName[] = "Thumbnail.ComputeMS"; | 20 static const char kThumbnailHistogramName[] = "Thumbnail.ComputeMS"; |
22 } | 21 } |
23 | 22 |
24 namespace thumbnails { | 23 namespace thumbnails { |
Lei Zhang
2016/04/28 20:13:10
I'd leave the blank line after this.
oshima
2016/04/28 20:19:04
Done.
| |
25 | |
26 SimpleThumbnailCrop::SimpleThumbnailCrop(const gfx::Size& target_size) | 24 SimpleThumbnailCrop::SimpleThumbnailCrop(const gfx::Size& target_size) |
27 : target_size_(target_size) { | 25 : target_size_(target_size) { |
28 DCHECK(!target_size.IsEmpty()); | 26 DCHECK(!target_size.IsEmpty()); |
29 } | 27 } |
30 | 28 |
31 ClipResult SimpleThumbnailCrop::GetCanvasCopyInfo(const gfx::Size& source_size, | 29 ClipResult SimpleThumbnailCrop::GetCanvasCopyInfo(const gfx::Size& source_size, |
32 ui::ScaleFactor scale_factor, | 30 ui::ScaleFactor scale_factor, |
33 gfx::Rect* clipping_rect, | 31 gfx::Rect* clipping_rect, |
34 gfx::Size* copy_size) const { | 32 gfx::Size* copy_size) const { |
35 DCHECK(!source_size.IsEmpty()); | 33 DCHECK(!source_size.IsEmpty()); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 clipped_bitmap.height() == result.height()) | 194 clipped_bitmap.height() == result.height()) |
197 clipped_bitmap.copyTo(&result, kN32_SkColorType); | 195 clipped_bitmap.copyTo(&result, kN32_SkColorType); |
198 #endif | 196 #endif |
199 | 197 |
200 LOCAL_HISTOGRAM_TIMES(kThumbnailHistogramName, | 198 LOCAL_HISTOGRAM_TIMES(kThumbnailHistogramName, |
201 base::TimeTicks::Now() - begin_compute_thumbnail); | 199 base::TimeTicks::Now() - begin_compute_thumbnail); |
202 return result; | 200 return result; |
203 } | 201 } |
204 | 202 |
205 } // namespace thumbnails | 203 } // namespace thumbnails |
OLD | NEW |