| 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 2548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2559 cc::SharedBitmapManager* manager = | 2559 cc::SharedBitmapManager* manager = |
| 2560 RenderThreadImpl::current()->shared_bitmap_manager(); | 2560 RenderThreadImpl::current()->shared_bitmap_manager(); |
| 2561 std::unique_ptr<cc::SharedBitmap> shared_bitmap = | 2561 std::unique_ptr<cc::SharedBitmap> shared_bitmap = |
| 2562 manager->AllocateSharedBitmap(canvas_size); | 2562 manager->AllocateSharedBitmap(canvas_size); |
| 2563 CHECK(!!shared_bitmap); | 2563 CHECK(!!shared_bitmap); |
| 2564 { | 2564 { |
| 2565 SkBitmap bitmap; | 2565 SkBitmap bitmap; |
| 2566 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), | 2566 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), |
| 2567 canvas_size.height()); | 2567 canvas_size.height()); |
| 2568 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); | 2568 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); |
| 2569 SkCanvas canvas(bitmap); | 2569 SkCanvas sk_canvas(bitmap); |
| 2570 cc::PaintCanvasPassThrough canvas(&sk_canvas); |
| 2570 | 2571 |
| 2571 // TODO(trchen): Cleanup the device scale factor mess. | 2572 // TODO(trchen): Cleanup the device scale factor mess. |
| 2572 // device scale will be applied in WebKit | 2573 // device scale will be applied in WebKit |
| 2573 // --> zoom_rect doesn't include device scale, | 2574 // --> zoom_rect doesn't include device scale, |
| 2574 // but WebKit will still draw on zoom_rect * device_scale_factor_ | 2575 // but WebKit will still draw on zoom_rect * device_scale_factor_ |
| 2575 canvas.scale(new_total_scale / device_scale_factor_, | 2576 canvas.scale(new_total_scale / device_scale_factor_, |
| 2576 new_total_scale / device_scale_factor_); | 2577 new_total_scale / device_scale_factor_); |
| 2577 canvas.translate(-zoom_rect.x() * device_scale_factor_, | 2578 canvas.translate(-zoom_rect.x() * device_scale_factor_, |
| 2578 -zoom_rect.y() * device_scale_factor_); | 2579 -zoom_rect.y() * device_scale_factor_); |
| 2579 | 2580 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2728 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2729 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2729 } | 2730 } |
| 2730 | 2731 |
| 2731 std::unique_ptr<InputEventAck> ack( | 2732 std::unique_ptr<InputEventAck> ack( |
| 2732 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), | 2733 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), |
| 2733 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2734 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 2734 OnInputEventAck(std::move(ack)); | 2735 OnInputEventAck(std::move(ack)); |
| 2735 } | 2736 } |
| 2736 | 2737 |
| 2737 } // namespace content | 2738 } // namespace content |
| OLD | NEW |