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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/task_scheduler/post_task.h" | 10 #include "base/task_scheduler/post_task.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 context->clip_result == CLIP_RESULT_TALLER_THAN_WIDE || | 86 context->clip_result == CLIP_RESULT_TALLER_THAN_WIDE || |
87 context->clip_result == CLIP_RESULT_NOT_CLIPPED || | 87 context->clip_result == CLIP_RESULT_NOT_CLIPPED || |
88 context->clip_result == CLIP_RESULT_SOURCE_SAME_AS_TARGET); | 88 context->clip_result == CLIP_RESULT_SOURCE_SAME_AS_TARGET); |
89 | 89 |
90 callback.Run(*context.get(), source_bitmap); | 90 callback.Run(*context.get(), source_bitmap); |
91 return; | 91 return; |
92 } | 92 } |
93 | 93 |
94 base::PostTaskWithTraits( | 94 base::PostTaskWithTraits( |
95 FROM_HERE, | 95 FROM_HERE, |
96 base::TaskTraits() | 96 {base::TaskPriority::BACKGROUND, |
97 .WithPriority(base::TaskPriority::BACKGROUND) | 97 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, |
98 .WithShutdownBehavior(base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN), | |
99 base::Bind(&CreateRetargetedThumbnail, source_bitmap, | 98 base::Bind(&CreateRetargetedThumbnail, source_bitmap, |
100 target_thumbnail_size, context, callback)); | 99 target_thumbnail_size, context, callback)); |
101 } | 100 } |
102 | 101 |
103 // static | 102 // static |
104 SkBitmap ContentBasedThumbnailingAlgorithm::PrepareSourceBitmap( | 103 SkBitmap ContentBasedThumbnailingAlgorithm::PrepareSourceBitmap( |
105 const SkBitmap& received_bitmap, | 104 const SkBitmap& received_bitmap, |
106 const gfx::Size& thumbnail_size, | 105 const gfx::Size& thumbnail_size, |
107 ThumbnailingContext* context) { | 106 ThumbnailingContext* context) { |
108 gfx::Size resize_target; | 107 gfx::Size resize_target; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } else { | 218 } else { |
220 clipping_rect = gfx::Rect(source_size); | 219 clipping_rect = gfx::Rect(source_size); |
221 target_size->SetSize(source_size.width() / 2, source_size.height() / 2); | 220 target_size->SetSize(source_size.width() / 2, source_size.height() / 2); |
222 *clip_result = CLIP_RESULT_NOT_CLIPPED; | 221 *clip_result = CLIP_RESULT_NOT_CLIPPED; |
223 } | 222 } |
224 | 223 |
225 return clipping_rect; | 224 return clipping_rect; |
226 } | 225 } |
227 | 226 |
228 } // namespace thumbnails | 227 } // namespace thumbnails |
OLD | NEW |