Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Side by Side Diff: chrome/browser/chromeos/login/simple_png_encoder.h

Issue 10883062: Resize and save custom wallpaper to large and small size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reviews Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 // Operation class that encodes existing in-memory image as PNG.
17 // It uses NO-COMPRESSION to save time.
18 class SimplePngEncoder
19 : public base::RefCountedThreadSafe<SimplePngEncoder> {
20 public:
21 // This callback is called after encoding to PNG completes.
22 typedef base::Callback<void(
23 scoped_refptr<base::RefCountedBytes>)> EncoderCallback;
24
25 SimplePngEncoder(scoped_refptr<base::RefCountedBytes> data,
26 SkBitmap image);
27
28 // Starts encoding task on worker pool.
29 void Run(EncoderCallback callback);
30
31 // Cancels encoding task when possible.
32 void Cancel();
33
34 private:
35 friend class base::RefCountedThreadSafe<SimplePngEncoder>;
36
37 ~SimplePngEncoder();
38
39 // Encodes a SkBitmap to PNG codec on worker pool.
Ivan Korotkov 2012/08/30 10:53:15 with PNG codec?..
bshe 2012/08/30 16:39:02 Done.
40 void EncodeWallpaper();
41
42 base::CancellationFlag cancel_flag_;
43
44 // Buffer to store encoded image.
45 scoped_refptr<base::RefCountedBytes> data_;
46 // Original image to encode.
47 SkBitmap image_;
48
49 DISALLOW_COPY_AND_ASSIGN(SimplePngEncoder);
50 };
51
52 } // namespace chromeos
53
54 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698