summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorsiva.gunturi@samsung.com <siva.gunturi@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-26 19:30:48 +0000
committersiva.gunturi@samsung.com <siva.gunturi@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-26 19:30:48 +0000
commit06c84460b74ffd5e4250a4c005751956b8a6a12d (patch)
tree9cc33a8235c0c9dd6fa7b36176ab6091faf6085a /content
parent750ff074db9c9b0cdbfd485bad27903c94b0dfd8 (diff)
downloadchromium_src-06c84460b74ffd5e4250a4c005751956b8a6a12d.zip
chromium_src-06c84460b74ffd5e4250a4c005751956b8a6a12d.tar.gz
chromium_src-06c84460b74ffd5e4250a4c005751956b8a6a12d.tar.bz2
API to Convert Java Bitmap Config to SkBitmap::Config
This patch implements a generic way of mapping Java Bitmap Config to SkBitmap::Config. And we use this API by providing GetScaledContentBitmap with a extra config parameter. It helps in passing the Bitmap.Config.Format from java directly to native, where we can directly get the SkBitmap::Config. BUG=342822 Review URL: https://codereview.chromium.org/157033007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253552 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/android/content_view_core_impl.cc5
-rw-r--r--content/browser/android/content_view_core_impl.h1
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc3
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.h1
-rw-r--r--content/public/browser/android/content_view_core.h1
5 files changed, 8 insertions, 3 deletions
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index fefc891..357d2a9 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -698,14 +698,15 @@ void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) {
void ContentViewCoreImpl::GetScaledContentBitmap(
float scale,
+ jobject jbitmap_config,
const base::Callback<void(bool, const SkBitmap&)>& result_callback) {
RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
if (!view) {
result_callback.Run(false, SkBitmap());
return;
}
-
- view->GetScaledContentBitmap(scale, result_callback);
+ SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config);
+ view->GetScaledContentBitmap(scale, skbitmap_format, result_callback);
}
void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) {
diff --git a/content/browser/android/content_view_core_impl.h b/content/browser/android/content_view_core_impl.h
index d88af6d..1e63521 100644
--- a/content/browser/android/content_view_core_impl.h
+++ b/content/browser/android/content_view_core_impl.h
@@ -59,6 +59,7 @@ class ContentViewCoreImpl : public ContentViewCore,
virtual void ShowPastePopup(int x, int y) OVERRIDE;
virtual void GetScaledContentBitmap(
float scale,
+ jobject bitmap_config,
const base::Callback<void(bool, const SkBitmap&)>& result_callback)
OVERRIDE;
virtual float GetDpiScale() const OVERRIDE;
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 16e367f..8db7f7c 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -253,6 +253,7 @@ void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) {
void RenderWidgetHostViewAndroid::GetScaledContentBitmap(
float scale,
+ SkBitmap::Config bitmap_config,
const base::Callback<void(bool, const SkBitmap&)>& result_callback) {
if (!IsSurfaceAvailableForCopy()) {
result_callback.Run(false, SkBitmap());
@@ -268,7 +269,7 @@ void RenderWidgetHostViewAndroid::GetScaledContentBitmap(
gfx::Size dst_size(
gfx::ToCeiledSize(gfx::ScaleSize(bounds, scale / device_scale_factor)));
CopyFromCompositingSurface(
- src_subrect, dst_size, result_callback, SkBitmap::kARGB_8888_Config);
+ src_subrect, dst_size, result_callback, bitmap_config);
}
bool RenderWidgetHostViewAndroid::PopulateBitmapWithContents(jobject jbitmap) {
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h
index f00aa7d..9709180 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.h
+++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -226,6 +226,7 @@ class RenderWidgetHostViewAndroid
void GetScaledContentBitmap(
float scale,
+ SkBitmap::Config bitmap_config,
const base::Callback<void(bool, const SkBitmap&)>& result_callback);
bool PopulateBitmapWithContents(jobject jbitmap);
diff --git a/content/public/browser/android/content_view_core.h b/content/public/browser/android/content_view_core.h
index 8437e7b..0f3503e 100644
--- a/content/public/browser/android/content_view_core.h
+++ b/content/public/browser/android/content_view_core.h
@@ -56,6 +56,7 @@ class CONTENT_EXPORT ContentViewCore {
// |out_size| is returned with the size of the content.
virtual void GetScaledContentBitmap(
float scale,
+ jobject bitmap_config,
const base::Callback<void(bool, const SkBitmap&)>& result_callback) = 0;
virtual float GetDpiScale() const = 0;
virtual void PauseVideo() = 0;