| Index: components/exo/pointer.cc
|
| diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc
|
| index 90551072ad04a24fbf7375224d7f6d47863c091b..360d0d95f9046ff10cacf07d26146caf94063d2c 100644
|
| --- a/components/exo/pointer.cc
|
| +++ b/components/exo/pointer.cc
|
| @@ -281,6 +281,7 @@ void Pointer::OnCursorDisplayChanging(const display::Display& display) {
|
| auto info = helper->GetDisplayInfo(display.id());
|
| display_scale_ = info.GetEffectiveUIScale() * info.device_scale_factor();
|
| device_scale_factor_ = display.device_scale_factor();
|
| + rotation_ = display.rotation();
|
|
|
| if (focus_ && surface_)
|
| CaptureCursor();
|
| @@ -336,19 +337,24 @@ void Pointer::CaptureCursor() {
|
|
|
| gfx::Transform transform;
|
| transform.Scale(layer_scale, layer_scale);
|
| + transform.Rotate(display::Display::RotateToDegree(rotation_));
|
| surface_->window()->SetTransform(transform);
|
|
|
| + gfx::Point hotspot = hotspot_;
|
| + aura::Window::ConvertPointToTarget(surface_->window(), cursor_.get(),
|
| + &hotspot);
|
| +
|
| std::unique_ptr<cc::CopyOutputRequest> request =
|
| cc::CopyOutputRequest::CreateBitmapRequest(
|
| base::Bind(&Pointer::OnCursorCaptured,
|
| cursor_capture_weak_ptr_factory_.GetWeakPtr(),
|
| - gfx::ScaleToFlooredPoint(hotspot_, scale)));
|
| + gfx::ScaleToFlooredPoint(hotspot, scale)));
|
|
|
| request->set_source(cursor_capture_source_id_);
|
| cursor_->layer()->RequestCopyOfOutput(std::move(request));
|
| }
|
|
|
| -void Pointer::OnCursorCaptured(const gfx::Point& hotspot,
|
| +void Pointer::OnCursorCaptured(gfx::Point hotspot,
|
| std::unique_ptr<cc::CopyOutputResult> result) {
|
| if (!focus_)
|
| return;
|
| @@ -358,6 +364,23 @@ void Pointer::OnCursorCaptured(const gfx::Point& hotspot,
|
| DCHECK(result->HasBitmap());
|
| std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap();
|
|
|
| + switch (rotation_) {
|
| + case display::Display::ROTATE_0:
|
| + break;
|
| +
|
| + case display::Display::ROTATE_90:
|
| + hotspot += gfx::Vector2d(bitmap->height(), 0);
|
| + break;
|
| +
|
| + case display::Display::ROTATE_180:
|
| + hotspot += gfx::Vector2d(bitmap->width(), bitmap->height());
|
| + break;
|
| +
|
| + case display::Display::ROTATE_270:
|
| + hotspot += gfx::Vector2d(0, bitmap->width());
|
| + break;
|
| + }
|
| +
|
| ui::PlatformCursor platform_cursor;
|
| #if defined(USE_OZONE)
|
| // TODO(reveman): Add interface for creating cursors from GpuMemoryBuffers
|
|
|