| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 2490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 cc::SharedBitmapManager* manager = | 2501 cc::SharedBitmapManager* manager = |
| 2502 RenderThreadImpl::current()->shared_bitmap_manager(); | 2502 RenderThreadImpl::current()->shared_bitmap_manager(); |
| 2503 std::unique_ptr<cc::SharedBitmap> shared_bitmap = | 2503 std::unique_ptr<cc::SharedBitmap> shared_bitmap = |
| 2504 manager->AllocateSharedBitmap(canvas_size); | 2504 manager->AllocateSharedBitmap(canvas_size); |
| 2505 CHECK(!!shared_bitmap); | 2505 CHECK(!!shared_bitmap); |
| 2506 { | 2506 { |
| 2507 SkBitmap bitmap; | 2507 SkBitmap bitmap; |
| 2508 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), | 2508 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), |
| 2509 canvas_size.height()); | 2509 canvas_size.height()); |
| 2510 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); | 2510 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); |
| 2511 SkCanvas canvas(bitmap); | 2511 SkCanvas sk_canvas(bitmap); |
| 2512 cc::PaintCanvasPassThrough canvas(&sk_canvas); |
| 2512 | 2513 |
| 2513 // TODO(trchen): Cleanup the device scale factor mess. | 2514 // TODO(trchen): Cleanup the device scale factor mess. |
| 2514 // device scale will be applied in WebKit | 2515 // device scale will be applied in WebKit |
| 2515 // --> zoom_rect doesn't include device scale, | 2516 // --> zoom_rect doesn't include device scale, |
| 2516 // but WebKit will still draw on zoom_rect * device_scale_factor_ | 2517 // but WebKit will still draw on zoom_rect * device_scale_factor_ |
| 2517 canvas.scale(new_total_scale / device_scale_factor_, | 2518 canvas.scale(new_total_scale / device_scale_factor_, |
| 2518 new_total_scale / device_scale_factor_); | 2519 new_total_scale / device_scale_factor_); |
| 2519 canvas.translate(-zoom_rect.x() * device_scale_factor_, | 2520 canvas.translate(-zoom_rect.x() * device_scale_factor_, |
| 2520 -zoom_rect.y() * device_scale_factor_); | 2521 -zoom_rect.y() * device_scale_factor_); |
| 2521 | 2522 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2689 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2690 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2690 } | 2691 } |
| 2691 | 2692 |
| 2692 std::unique_ptr<InputEventAck> ack( | 2693 std::unique_ptr<InputEventAck> ack( |
| 2693 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), | 2694 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), |
| 2694 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2695 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 2695 OnInputEventAck(std::move(ack)); | 2696 OnInputEventAck(std::move(ack)); |
| 2696 } | 2697 } |
| 2697 | 2698 |
| 2698 } // namespace content | 2699 } // namespace content |
| OLD | NEW |