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

Unified Diff: ui/gfx/android/java_bitmap.cc

Issue 1136053003: Check whether Java bitmap memory size is same to one of SkBitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « ui/gfx/android/java_bitmap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/android/java_bitmap.cc
diff --git a/ui/gfx/android/java_bitmap.cc b/ui/gfx/android/java_bitmap.cc
index 37da9d98aaf67e231d739460038564a29f317a09..32d3d0ee6b0d6442bfad89f19465b893a6ece68d 100644
--- a/ui/gfx/android/java_bitmap.cc
+++ b/ui/gfx/android/java_bitmap.cc
@@ -29,6 +29,7 @@ JavaBitmap::JavaBitmap(jobject bitmap)
size_ = gfx::Size(info.width, info.height);
format_ = info.format;
stride_ = info.stride;
+ byte_count_ = Java_BitmapHelper_getByteCount(AttachCurrentThread(), bitmap_);
}
JavaBitmap::~JavaBitmap() {
@@ -108,6 +109,7 @@ SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap) {
CHECK(false) << "Invalid Java bitmap format: " << jbitmap.format();
break;
}
+ CHECK_EQ(jbitmap.byte_count(), (int) skbitmap.getSize());
jdduke (slow) 2015/05/11 22:14:49 nit: static_cast<int>
Jaekyun Seok (inactive) 2015/05/11 23:07:24 Done.
const void* src_pixels = jbitmap.pixels();
void* dst_pixels = skbitmap.getPixels();
memcpy(dst_pixels, src_pixels, skbitmap.getSize());
« no previous file with comments | « ui/gfx/android/java_bitmap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698