diff options
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/native/aw_contents.cc | 6 | ||||
-rw-r--r-- | android_webview/native/aw_contents.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index 28f6f18..ff8483c 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc @@ -170,6 +170,7 @@ AwContents::AwContents(JNIEnv* env, view_visible_(false), compositor_visible_(false), is_composite_pending_(false), + dpi_scale_(1.0f), on_new_picture_mode_(kOnNewPictureDisabled), last_frame_context_(NULL) { RendererPictureMap::CreateInstance(); @@ -507,6 +508,8 @@ void AwContents::DidInitializeContentViewCore(JNIEnv* env, jobject obj, ContentViewCore* core = reinterpret_cast<ContentViewCore*>(content_view_core); DCHECK(core == ContentViewCore::FromWebContents(web_contents_.get())); + dpi_scale_ = core->GetDpiScale(); + // Ensures content keeps clipped within the view during transformations. view_clip_layer_ = cc::Layer::create(); view_clip_layer_->setBounds(view_size_); @@ -1018,6 +1021,9 @@ bool AwContents::RenderPicture(SkCanvas* canvas) { if (!picture) return false; + // Correct device scale. + canvas->scale(dpi_scale_, dpi_scale_); + picture->draw(canvas); return true; } diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h index 6747ac7..c2b7e49 100644 --- a/android_webview/native/aw_contents.h +++ b/android_webview/native/aw_contents.h @@ -193,6 +193,7 @@ class AwContents : public FindHelper::Listener, bool view_visible_; bool compositor_visible_; bool is_composite_pending_; + float dpi_scale_; OnNewPictureMode on_new_picture_mode_; // Used only for detecting Android View System context changes. |