OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 if (!IsSurfaceAvailableForCopy()) { | 559 if (!IsSurfaceAvailableForCopy()) { |
560 callback.Run(false, SkBitmap()); | 560 callback.Run(false, SkBitmap()); |
561 return; | 561 return; |
562 } | 562 } |
563 | 563 |
564 const gfx::Display& display = | 564 const gfx::Display& display = |
565 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 565 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
566 float device_scale_factor = display.device_scale_factor(); | 566 float device_scale_factor = display.device_scale_factor(); |
567 | 567 |
568 DCHECK_EQ(device_scale_factor, | 568 DCHECK_EQ(device_scale_factor, |
569 ui::GetScaleFactorScale(GetScaleFactorForView(this))); | 569 ui::GetImageScale(GetScaleFactorForView(this))); |
570 | 570 |
571 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); | 571 const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); |
572 gfx::Rect src_subrect_in_pixel = | 572 gfx::Rect src_subrect_in_pixel = |
573 ConvertRectToPixel(device_scale_factor, src_subrect); | 573 ConvertRectToPixel(device_scale_factor, src_subrect); |
574 | 574 |
575 scoped_ptr<cc::CopyOutputRequest> request; | 575 scoped_ptr<cc::CopyOutputRequest> request; |
576 if (src_subrect_in_pixel.size() == dst_size_in_pixel) { | 576 if (src_subrect_in_pixel.size() == dst_size_in_pixel) { |
577 request = cc::CopyOutputRequest::CreateBitmapRequest(base::Bind( | 577 request = cc::CopyOutputRequest::CreateBitmapRequest(base::Bind( |
578 &RenderWidgetHostViewAndroid::PrepareBitmapCopyOutputResult, | 578 &RenderWidgetHostViewAndroid::PrepareBitmapCopyOutputResult, |
579 dst_size_in_pixel, | 579 dst_size_in_pixel, |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 // RenderWidgetHostView, public: | 1303 // RenderWidgetHostView, public: |
1304 | 1304 |
1305 // static | 1305 // static |
1306 RenderWidgetHostView* | 1306 RenderWidgetHostView* |
1307 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 1307 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
1308 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 1308 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
1309 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 1309 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
1310 } | 1310 } |
1311 | 1311 |
1312 } // namespace content | 1312 } // namespace content |
OLD | NEW |