| 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 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 cc::SharedBitmapManager* manager = | 2531 cc::SharedBitmapManager* manager = |
| 2532 RenderThreadImpl::current()->shared_bitmap_manager(); | 2532 RenderThreadImpl::current()->shared_bitmap_manager(); |
| 2533 std::unique_ptr<cc::SharedBitmap> shared_bitmap = | 2533 std::unique_ptr<cc::SharedBitmap> shared_bitmap = |
| 2534 manager->AllocateSharedBitmap(canvas_size); | 2534 manager->AllocateSharedBitmap(canvas_size); |
| 2535 CHECK(!!shared_bitmap); | 2535 CHECK(!!shared_bitmap); |
| 2536 { | 2536 { |
| 2537 SkBitmap bitmap; | 2537 SkBitmap bitmap; |
| 2538 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), | 2538 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), |
| 2539 canvas_size.height()); | 2539 canvas_size.height()); |
| 2540 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); | 2540 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); |
| 2541 SkCanvas canvas(bitmap); | 2541 SkCanvas sk_canvas(bitmap); |
| 2542 cc::PaintCanvasPassThrough canvas(&sk_canvas); |
| 2542 | 2543 |
| 2543 // TODO(trchen): Cleanup the device scale factor mess. | 2544 // TODO(trchen): Cleanup the device scale factor mess. |
| 2544 // device scale will be applied in WebKit | 2545 // device scale will be applied in WebKit |
| 2545 // --> zoom_rect doesn't include device scale, | 2546 // --> zoom_rect doesn't include device scale, |
| 2546 // but WebKit will still draw on zoom_rect * device_scale_factor_ | 2547 // but WebKit will still draw on zoom_rect * device_scale_factor_ |
| 2547 canvas.scale(new_total_scale / device_scale_factor_, | 2548 canvas.scale(new_total_scale / device_scale_factor_, |
| 2548 new_total_scale / device_scale_factor_); | 2549 new_total_scale / device_scale_factor_); |
| 2549 canvas.translate(-zoom_rect.x() * device_scale_factor_, | 2550 canvas.translate(-zoom_rect.x() * device_scale_factor_, |
| 2550 -zoom_rect.y() * device_scale_factor_); | 2551 -zoom_rect.y() * device_scale_factor_); |
| 2551 | 2552 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2701 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2701 } | 2702 } |
| 2702 | 2703 |
| 2703 std::unique_ptr<InputEventAck> ack( | 2704 std::unique_ptr<InputEventAck> ack( |
| 2704 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), | 2705 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), |
| 2705 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2706 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 2706 OnInputEventAck(std::move(ack)); | 2707 OnInputEventAck(std::move(ack)); |
| 2707 } | 2708 } |
| 2708 | 2709 |
| 2709 } // namespace content | 2710 } // namespace content |
| OLD | NEW |