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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/simple_png_encoder.h
diff --git a/chrome/browser/chromeos/login/simple_png_encoder.h b/chrome/browser/chromeos/login/simple_png_encoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..0039cf0099ee456d8d6e3ba7e1d43c2c0550b299
--- /dev/null
+++ b/chrome/browser/chromeos/login/simple_png_encoder.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "base/memory/ref_counted_memory.h"
+#include "base/synchronization/cancellation_flag.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace chromeos {
+
+// Operation class that encodes existing in-memory image as PNG.
+// It uses NO-COMPRESSION to save time.
+class SimplePngEncoder
+ : public base::RefCountedThreadSafe<SimplePngEncoder> {
+ public:
+ // This callback is called after encoding to PNG completes.
+ typedef base::Callback<void(
+ scoped_refptr<base::RefCountedBytes>)> EncoderCallback;
+
+ SimplePngEncoder(scoped_refptr<base::RefCountedBytes> data,
+ SkBitmap image);
+
+ // Starts encoding task on worker pool.
+ void Run(EncoderCallback callback);
+
+ // Cancels encoding task when possible.
+ void Cancel();
+
+ private:
+ friend class base::RefCountedThreadSafe<SimplePngEncoder>;
+
+ ~SimplePngEncoder();
+
+ // 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.
+ void EncodeWallpaper();
+
+ base::CancellationFlag cancel_flag_;
+
+ // Buffer to store encoded image.
+ scoped_refptr<base::RefCountedBytes> data_;
+ // Original image to encode.
+ SkBitmap image_;
+
+ DISALLOW_COPY_AND_ASSIGN(SimplePngEncoder);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_

Powered by Google App Engine
This is Rietveld 408576698