OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/content_based_thumbnailing_algorithm.h" | 5 #include "chrome/browser/thumbnails/content_based_thumbnailing_algorithm.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
9 #include "chrome/browser/thumbnails/content_analysis.h" | 9 #include "chrome/browser/thumbnails/content_analysis.h" |
10 #include "chrome/browser/thumbnails/simple_thumbnail_crop.h" | 10 #include "chrome/browser/thumbnails/simple_thumbnail_crop.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ClipResult clipping_method = thumbnails::CLIP_RESULT_NOT_CLIPPED; | 53 ClipResult clipping_method = thumbnails::CLIP_RESULT_NOT_CLIPPED; |
54 *clipping_rect = GetClippingRect(source_size, copy_thumbnail_size, copy_size, | 54 *clipping_rect = GetClippingRect(source_size, copy_thumbnail_size, copy_size, |
55 &clipping_method); | 55 &clipping_method); |
56 return clipping_method; | 56 return clipping_method; |
57 } | 57 } |
58 | 58 |
59 void ContentBasedThumbnailingAlgorithm::ProcessBitmap( | 59 void ContentBasedThumbnailingAlgorithm::ProcessBitmap( |
60 scoped_refptr<ThumbnailingContext> context, | 60 scoped_refptr<ThumbnailingContext> context, |
61 const ConsumerCallback& callback, | 61 const ConsumerCallback& callback, |
62 const SkBitmap& bitmap) { | 62 const SkBitmap& bitmap) { |
63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 63 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
64 DCHECK(context.get()); | 64 DCHECK(context.get()); |
65 if (bitmap.isNull() || bitmap.empty()) | 65 if (bitmap.isNull() || bitmap.empty()) |
66 return; | 66 return; |
67 | 67 |
68 gfx::Size target_thumbnail_size = | 68 gfx::Size target_thumbnail_size = |
69 SimpleThumbnailCrop::ComputeTargetSizeAtMaximumScale(target_size_); | 69 SimpleThumbnailCrop::ComputeTargetSizeAtMaximumScale(target_size_); |
70 | 70 |
71 SkBitmap source_bitmap = | 71 SkBitmap source_bitmap = |
72 PrepareSourceBitmap(bitmap, target_thumbnail_size, context.get()); | 72 PrepareSourceBitmap(bitmap, target_thumbnail_size, context.get()); |
73 | 73 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } else { | 233 } else { |
234 clipping_rect = gfx::Rect(source_size); | 234 clipping_rect = gfx::Rect(source_size); |
235 target_size->SetSize(source_size.width() / 2, source_size.height() / 2); | 235 target_size->SetSize(source_size.width() / 2, source_size.height() / 2); |
236 *clip_result = CLIP_RESULT_NOT_CLIPPED; | 236 *clip_result = CLIP_RESULT_NOT_CLIPPED; |
237 } | 237 } |
238 | 238 |
239 return clipping_rect; | 239 return clipping_rect; |
240 } | 240 } |
241 | 241 |
242 } // namespace thumbnails | 242 } // namespace thumbnails |
OLD | NEW |