Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/ref_counted_memory.h" | |
| 11 #include "base/synchronization/cancellation_flag.h" | |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | |
| 13 | |
| 14 namespace chromeos { | |
| 15 | |
| 16 typedef base::Callback<void( | |
|
Ivan Korotkov
2012/08/28 16:16:13
Since this name is pretty generic, please move it
bshe
2012/08/29 14:30:07
Done.
| |
| 17 scoped_refptr<base::RefCountedBytes>)> EncoderCallback; | |
| 18 | |
| 19 // Operation class that encodes existing in-memory image as PNG. | |
| 20 // It uses NO-COMPRESSION to save time. | |
| 21 class SimplePngEncoder | |
| 22 : public base::RefCountedThreadSafe<SimplePngEncoder> { | |
| 23 public: | |
| 24 SimplePngEncoder(scoped_refptr<base::RefCountedBytes> data, | |
| 25 SkBitmap image); | |
| 26 | |
| 27 void Run(EncoderCallback callback); | |
|
Ivan Korotkov
2012/08/28 16:16:13
Please document these functions.
bshe
2012/08/29 14:30:07
Done.
| |
| 28 | |
| 29 void EncodeWallpaper(); | |
|
Ivan Korotkov
2012/08/28 16:16:13
Looks like it doesn't need to be public.
bshe
2012/08/29 14:30:07
Moved to private.
On 2012/08/28 16:16:13, Ivan Ko
| |
| 30 void Cancel(); | |
| 31 | |
| 32 private: | |
| 33 friend class base::RefCountedThreadSafe<SimplePngEncoder>; | |
| 34 | |
| 35 ~SimplePngEncoder(); | |
| 36 | |
| 37 base::CancellationFlag cancel_flag_; | |
| 38 | |
| 39 // Buffer to store encoded image. | |
| 40 scoped_refptr<base::RefCountedBytes> data_; | |
| 41 // Original image to encode. | |
| 42 SkBitmap image_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(SimplePngEncoder); | |
| 45 }; | |
| 46 | |
| 47 } // namespace chromeos | |
| 48 | |
| 49 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_ | |
| OLD | NEW |