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 sk_canvas(bitmap); | 2541 cc::PaintCanvas canvas(bitmap); |
2542 cc::PaintCanvasPassThrough canvas(&sk_canvas); | |
2543 | 2542 |
2544 // TODO(trchen): Cleanup the device scale factor mess. | 2543 // TODO(trchen): Cleanup the device scale factor mess. |
2545 // device scale will be applied in WebKit | 2544 // device scale will be applied in WebKit |
2546 // --> zoom_rect doesn't include device scale, | 2545 // --> zoom_rect doesn't include device scale, |
2547 // but WebKit will still draw on zoom_rect * device_scale_factor_ | 2546 // but WebKit will still draw on zoom_rect * device_scale_factor_ |
2548 canvas.scale(new_total_scale / device_scale_factor_, | 2547 canvas.scale(new_total_scale / device_scale_factor_, |
2549 new_total_scale / device_scale_factor_); | 2548 new_total_scale / device_scale_factor_); |
2550 canvas.translate(-zoom_rect.x() * device_scale_factor_, | 2549 canvas.translate(-zoom_rect.x() * device_scale_factor_, |
2551 -zoom_rect.y() * device_scale_factor_); | 2550 -zoom_rect.y() * device_scale_factor_); |
2552 | 2551 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2720 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2719 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
2721 } | 2720 } |
2722 | 2721 |
2723 std::unique_ptr<InputEventAck> ack( | 2722 std::unique_ptr<InputEventAck> ack( |
2724 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), | 2723 new InputEventAck(InputEventAckSource::MAIN_THREAD, input_event->type(), |
2725 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2724 INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
2726 OnInputEventAck(std::move(ack)); | 2725 OnInputEventAck(std::move(ack)); |
2727 } | 2726 } |
2728 | 2727 |
2729 } // namespace content | 2728 } // namespace content |
OLD | NEW |