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

Unified Diff: ui/gfx/android/bitmap_android.h

Issue 10823094: Add bitmap utils for Chrome on Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Include fixes from downstream Created 8 years, 5 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: ui/gfx/android/bitmap_android.h
diff --git a/ui/gfx/android/bitmap_android.h b/ui/gfx/android/bitmap_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..d23fcfe370afdbbc747b597813e23ec7aa115841
--- /dev/null
+++ b/ui/gfx/android/bitmap_android.h
@@ -0,0 +1,42 @@
+// 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 UI_GFX_BITMAP_ANDROID_H_
+#define UI_GFX_BITMAP_ANDROID_H_
+
+#include "base/android/scoped_java_ref.h"
+#include "ui/gfx/size.h"
+
+class SkBitmap;
+
+using base::android::ScopedJavaLocalRef;
sky 2012/08/03 17:15:36 No using in headers.
Jesse Greenwald 2012/08/03 20:10:06 Done.
+
+namespace gfx {
+
+class AutoLockJavaBitmap {
nilesh 2012/08/03 04:52:36 Please add a class level comment.
sky 2012/08/03 17:15:36 Do you need to export this class?
sky 2012/08/03 17:15:36 Filename should match class name.
Jesse Greenwald 2012/08/03 20:10:06 Done.
+ public:
+ AutoLockJavaBitmap(jobject bitmap);
sky 2012/08/03 17:15:36 explicit
Jesse Greenwald 2012/08/03 20:10:06 Done.
+ ~AutoLockJavaBitmap();
+
+ void* pixels() const { return pixels_; }
sky 2012/08/03 17:15:36 Generally its bad practice to return a non-const p
Jesse Greenwald 2012/08/03 20:10:06 Done - change it so that it's not a const function
+ gfx::Size size() const;
sky 2012/08/03 17:15:36 unix_hacker_style function names are intended for
Jesse Greenwald 2012/08/03 20:10:06 Done.
+ // Formats are in android/bitmap.h; e.g. ANDROID_BITMAP_FORMAT_RGBA_8888
+ int format() const;
+ uint32_t stride() const;
+
+ private:
+ jobject bitmap_;
+ void* pixels_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutoLockJavaBitmap);
+};
+
+base::android::ScopedJavaLocalRef<jobject> CreateJavaBitmap(
+ const gfx::Size& size);
+
+ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(const SkBitmap* skbitmap);
+
+} // namespace gfx
+
+#endif // UI_GFX_BITMAP_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698