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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 6319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6330 gfx::Rect finger_rect( | 6330 gfx::Rect finger_rect( |
6331 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, | 6331 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, |
6332 event.data.tap.width, event.data.tap.height); | 6332 event.data.tap.width, event.data.tap.height); |
6333 gfx::Rect zoom_rect; | 6333 gfx::Rect zoom_rect; |
6334 float scale = DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( | 6334 float scale = DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( |
6335 finger_rect, target_rects, GetSize(), &zoom_rect); | 6335 finger_rect, target_rects, GetSize(), &zoom_rect); |
6336 if (!scale) | 6336 if (!scale) |
6337 return false; | 6337 return false; |
6338 | 6338 |
6339 gfx::Size canvas_size = zoom_rect.size(); | 6339 gfx::Size canvas_size = zoom_rect.size(); |
6340 canvas_size = ToCeiledSize(canvas_size.Scale(scale)); | 6340 canvas_size = ToCeiledSize(gfx::ScaleSize(canvas_size, scale)); |
6341 TransportDIB* transport_dib = NULL; | 6341 TransportDIB* transport_dib = NULL; |
6342 { | 6342 { |
6343 scoped_ptr<skia::PlatformCanvas> canvas( | 6343 scoped_ptr<skia::PlatformCanvas> canvas( |
6344 RenderProcess::current()->GetDrawingCanvas(&transport_dib, | 6344 RenderProcess::current()->GetDrawingCanvas(&transport_dib, |
6345 gfx::Rect(canvas_size))); | 6345 gfx::Rect(canvas_size))); |
6346 if (!canvas.get()) | 6346 if (!canvas.get()) |
6347 return false; | 6347 return false; |
6348 | 6348 |
6349 canvas->scale(scale, scale); | 6349 canvas->scale(scale, scale); |
6350 | 6350 |
(...skipping 10 matching lines...) Expand all Loading... |
6361 } | 6361 } |
6362 #endif | 6362 #endif |
6363 | 6363 |
6364 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6364 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6365 TransportDIB::Handle dib_handle) { | 6365 TransportDIB::Handle dib_handle) { |
6366 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6366 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6367 RenderProcess::current()->ReleaseTransportDIB(dib); | 6367 RenderProcess::current()->ReleaseTransportDIB(dib); |
6368 } | 6368 } |
6369 | 6369 |
6370 } // namespace content | 6370 } // namespace content |
OLD | NEW |