summaryrefslogtreecommitdiffstats
path: root/android_webview/browser
diff options
context:
space:
mode:
Diffstat (limited to 'android_webview/browser')
-rw-r--r--android_webview/browser/browser_view_renderer.h4
-rw-r--r--android_webview/browser/in_process_view_renderer.cc20
-rw-r--r--android_webview/browser/in_process_view_renderer.h4
3 files changed, 17 insertions, 11 deletions
diff --git a/android_webview/browser/browser_view_renderer.h b/android_webview/browser/browser_view_renderer.h
index 613b36a..0f5d53f 100644
--- a/android_webview/browser/browser_view_renderer.h
+++ b/android_webview/browser/browser_view_renderer.h
@@ -102,7 +102,9 @@ class BrowserViewRenderer {
virtual void DrawGL(AwDrawGLInfo* draw_info) = 0;
// CapturePicture API methods.
- virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() = 0;
+ virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture(
+ int width,
+ int height) = 0;
virtual void EnableOnNewPicture(bool enabled) = 0;
// View update notifications.
diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc
index dbb4c24..4cb053a 100644
--- a/android_webview/browser/in_process_view_renderer.cc
+++ b/android_webview/browser/in_process_view_renderer.cc
@@ -10,6 +10,7 @@
#include "android_webview/public/browser/draw_gl.h"
#include "android_webview/public/browser/draw_sw.h"
#include "base/android/jni_android.h"
+#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
@@ -363,26 +364,27 @@ bool InProcessViewRenderer::DrawSWInternal(jobject java_canvas,
}
base::android::ScopedJavaLocalRef<jobject>
-InProcessViewRenderer::CapturePicture() {
+InProcessViewRenderer::CapturePicture(int width, int height) {
if (!compositor_ || !GetAwDrawSWFunctionTable()) {
TRACE_EVENT_INSTANT0(
"android_webview", "EarlyOut_CapturePicture", TRACE_EVENT_SCOPE_THREAD);
return ScopedJavaLocalRef<jobject>();
}
- gfx::Size record_size(width_, height_);
-
// Return empty Picture objects for empty SkPictures.
JNIEnv* env = AttachCurrentThread();
- if (record_size.width() <= 0 || record_size.height() <= 0) {
- return java_helper_->RecordBitmapIntoPicture(
- env, ScopedJavaLocalRef<jobject>());
+ if (width <= 0 || height <= 0) {
+ return java_helper_->RecordBitmapIntoPicture(env,
+ ScopedJavaLocalRef<jobject>());
}
+ // Reset scroll back to the origin, will go back to the old
+ // value when scroll_reset is out of scope.
+ base::AutoReset<gfx::Vector2dF> scroll_reset(&scroll_offset_css_,
+ gfx::Vector2d());
+
skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
- SkCanvas* rec_canvas = picture->beginRecording(record_size.width(),
- record_size.height(),
- 0);
+ SkCanvas* rec_canvas = picture->beginRecording(width, height, 0);
if (!CompositeSW(rec_canvas))
return ScopedJavaLocalRef<jobject>();
picture->endRecording();
diff --git a/android_webview/browser/in_process_view_renderer.h b/android_webview/browser/in_process_view_renderer.h
index e4f6dd5..642c8a8 100644
--- a/android_webview/browser/in_process_view_renderer.h
+++ b/android_webview/browser/in_process_view_renderer.h
@@ -43,7 +43,9 @@ class InProcessViewRenderer : public BrowserViewRenderer,
const gfx::Rect& clip,
const gfx::Rect& visible_rect) OVERRIDE;
virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE;
- virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture() OVERRIDE;
+ virtual base::android::ScopedJavaLocalRef<jobject> CapturePicture(
+ int width,
+ int height) OVERRIDE;
virtual void EnableOnNewPicture(bool enabled) OVERRIDE;
virtual void OnVisibilityChanged(bool visible) OVERRIDE;
virtual void OnSizeChanged(int width, int height) OVERRIDE;