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 #ifndef COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ | 5 #ifndef COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ |
6 #define COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ | 6 #define COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 class WALLPAPER_EXPORT WallpaperResizer { | 31 class WALLPAPER_EXPORT WallpaperResizer { |
32 public: | 32 public: |
33 // Returns a unique identifier corresponding to |image|, suitable for | 33 // Returns a unique identifier corresponding to |image|, suitable for |
34 // comparison against the value returned by original_image_id(). If the image | 34 // comparison against the value returned by original_image_id(). If the image |
35 // is modified, its ID will change. | 35 // is modified, its ID will change. |
36 static uint32_t GetImageId(const gfx::ImageSkia& image); | 36 static uint32_t GetImageId(const gfx::ImageSkia& image); |
37 | 37 |
38 WallpaperResizer(const gfx::ImageSkia& image, | 38 WallpaperResizer(const gfx::ImageSkia& image, |
39 const gfx::Size& target_size, | 39 const gfx::Size& target_size, |
40 WallpaperLayout layout, | 40 WallpaperLayout layout, |
41 const scoped_refptr<base::TaskRunner>& task_runner); | 41 scoped_refptr<base::TaskRunner> task_runner); |
42 | 42 |
43 ~WallpaperResizer(); | 43 ~WallpaperResizer(); |
44 | 44 |
45 const gfx::ImageSkia& image() const { return image_; } | 45 const gfx::ImageSkia& image() const { return image_; } |
46 uint32_t original_image_id() const { return original_image_id_; } | 46 uint32_t original_image_id() const { return original_image_id_; } |
47 WallpaperLayout layout() const { return layout_; } | 47 WallpaperLayout layout() const { return layout_; } |
48 | 48 |
49 // Called on the UI thread to run Resize() on the task runner and post an | 49 // Called on the UI thread to run Resize() on the task runner and post an |
50 // OnResizeFinished() task back to the UI thread on completion. | 50 // OnResizeFinished() task back to the UI thread on completion. |
51 void StartResize(); | 51 void StartResize(); |
(...skipping 24 matching lines...) Expand all Loading... |
76 scoped_refptr<base::TaskRunner> task_runner_; | 76 scoped_refptr<base::TaskRunner> task_runner_; |
77 | 77 |
78 base::WeakPtrFactory<WallpaperResizer> weak_ptr_factory_; | 78 base::WeakPtrFactory<WallpaperResizer> weak_ptr_factory_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(WallpaperResizer); | 80 DISALLOW_COPY_AND_ASSIGN(WallpaperResizer); |
81 }; | 81 }; |
82 | 82 |
83 } // namespace wallpaper | 83 } // namespace wallpaper |
84 | 84 |
85 #endif // COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ | 85 #endif // COMPONENTS_WALLPAPER_WALLPAPER_RESIZER_H_ |
OLD | NEW |