summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-20 23:44:09 +0000
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-20 23:44:09 +0000
commite717d28d17331078b28053fa1f0b19012440ad40 (patch)
treeaeec531e1f8f9499415380581c1178c010a013bd /webkit
parentfbaa287582dcf3e08171d40b153ab28328c26b95 (diff)
downloadchromium_src-e717d28d17331078b28053fa1f0b19012440ad40.zip
chromium_src-e717d28d17331078b28053fa1f0b19012440ad40.tar.gz
chromium_src-e717d28d17331078b28053fa1f0b19012440ad40.tar.bz2
Fix RGBA pixel layout when reading image from clipboard.
Pixel layout on Android is RGBA. Original patch was created by zhenghao@ in Android downstream. The changed code is used in webkit unit tests, layout tests and test_shell. BUG=none Review URL: https://chromiumcodereview.appspot.com/10824366 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152424 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/tools/test_shell/mock_webclipboard_impl.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/mock_webclipboard_impl.cc b/webkit/tools/test_shell/mock_webclipboard_impl.cc
index e21269a..e280e4e 100644
--- a/webkit/tools/test_shell/mock_webclipboard_impl.cc
+++ b/webkit/tools/test_shell/mock_webclipboard_impl.cc
@@ -105,12 +105,20 @@ WebKit::WebData MockWebClipboardImpl::readImage(
// for endianess reasons, it will be BGRA8888 on Windows.
const SkBitmap& bitmap = m_image.getSkBitmap();
SkAutoLockPixels lock(bitmap);
+#if defined(OS_ANDROID)
+ webkit_support::EncodeRGBAPNG(static_cast<unsigned char*>(bitmap.getPixels()),
+ bitmap.width(),
+ bitmap.height(),
+ bitmap.rowBytes(),
+ &encoded_image);
+#else
webkit_support::EncodeBGRAPNG(static_cast<unsigned char*>(bitmap.getPixels()),
bitmap.width(),
bitmap.height(),
bitmap.rowBytes(),
false,
&encoded_image);
+#endif
data.assign(reinterpret_cast<char*>(vector_as_array(&encoded_image)),
encoded_image.size());
return data;