Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAILING_ALGORITHM_H_ | |
| 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAILING_ALGORITHM_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "chrome/browser/thumbnails/thumbnailing_context.h" | |
| 10 #include "ui/gfx/rect.h" | |
| 11 #include "ui/gfx/size.h" | |
| 12 | |
| 13 class SkBitmap; | |
| 14 | |
| 15 namespace thumbnails { | |
| 16 | |
| 17 // An interface abstracting thumbnailing algorithms. Instances are intended to | |
| 18 // be created by ThumbnailService's implementations and used by | |
| 19 // ThumbnailTabHelper as consumers of captured source images. | |
| 20 class ThumbnailingAlgorithm | |
| 21 : public base::RefCountedThreadSafe<ThumbnailingAlgorithm> { | |
| 22 public: | |
| 23 typedef base::Callback<void(ThumbnailingContext*, const SkBitmap&)> | |
| 24 ConsumerCallback; | |
| 25 // Provides information necessary to crop-and-resize image data from a source | |
| 26 // canvas of |source_size|. Auxiliary |scale_factor| helps compute the target | |
| 27 // thumbnail size. Parameters of the required copy operation are assigned to | |
| 28 // |clipping_rect| (cropping rectangle for the source canvas) and | |
| 29 // |target_size| (the size of the target bitmap). | |
| 30 // The return value indicates the type of clipping that will be done. | |
| 31 virtual ClipResult GetCanvasCopyInfo(const gfx::Size& source_size, | |
| 32 ui::ScaleFactor scale_factor, | |
| 33 gfx::Rect* clipping_rect, | |
| 34 gfx::Size* target_size) const = 0; | |
| 35 | |
| 36 | |
| 37 virtual void ProcessBitmap(ThumbnailingContext* context, | |
|
mazda
2013/01/17 18:08:43
Please add a comment.
motek.
2013/01/17 18:39:42
Done.
| |
| 38 const SkBitmap& bitmap, | |
| 39 const ConsumerCallback& callback) = 0; | |
| 40 | |
| 41 protected: | |
| 42 virtual ~ThumbnailingAlgorithm() {} | |
| 43 friend class base::RefCountedThreadSafe<ThumbnailingAlgorithm>; | |
| 44 }; | |
| 45 | |
| 46 } | |
| 47 | |
| 48 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAILING_ALGORITHM_H_ | |
| OLD | NEW |