Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: content/common/cursors/webcursor_aurax11.cc

Issue 437593007: Don't rotate WebCursor based on display rotation in X11 Aura. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/cursors/webcursor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/cursors/webcursor.h" 5 #include "content/common/cursors/webcursor.h"
6 6
7 #include <X11/cursorfont.h> 7 #include <X11/cursorfont.h>
8 #include <X11/Xcursor/Xcursor.h> 8 #include <X11/Xcursor/Xcursor.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 10
(...skipping 11 matching lines...) Expand all
22 return platform_cursor_; 22 return platform_cursor_;
23 23
24 if (custom_data_.size() == 0) 24 if (custom_data_.size() == 0)
25 return 0; 25 return 0;
26 26
27 SkBitmap bitmap; 27 SkBitmap bitmap;
28 bitmap.allocN32Pixels(custom_size_.width(), custom_size_.height()); 28 bitmap.allocN32Pixels(custom_size_.width(), custom_size_.height());
29 memcpy(bitmap.getAddr32(0, 0), custom_data_.data(), custom_data_.size()); 29 memcpy(bitmap.getAddr32(0, 0), custom_data_.data(), custom_data_.size());
30 gfx::Point hotspot = hotspot_; 30 gfx::Point hotspot = hotspot_;
31 ui::ScaleAndRotateCursorBitmapAndHotpoint( 31 ui::ScaleAndRotateCursorBitmapAndHotpoint(
32 device_scale_factor_, rotation_, &bitmap, &hotspot); 32 device_scale_factor_, gfx::Display::ROTATE_0, &bitmap, &hotspot);
33 33
34 XcursorImage* image = ui::SkBitmapToXcursorImage(&bitmap, hotspot); 34 XcursorImage* image = ui::SkBitmapToXcursorImage(&bitmap, hotspot);
35 platform_cursor_ = ui::CreateReffedCustomXCursor(image); 35 platform_cursor_ = ui::CreateReffedCustomXCursor(image);
36 return platform_cursor_; 36 return platform_cursor_;
37 } 37 }
38 38
39 void WebCursor::SetDisplayInfo(const gfx::Display& display) { 39 void WebCursor::SetDisplayInfo(const gfx::Display& display) {
40 if (rotation_ == display.rotation() && 40 if (device_scale_factor_ == display.device_scale_factor())
41 device_scale_factor_ == display.device_scale_factor())
42 return; 41 return;
43 42
44 device_scale_factor_ = display.device_scale_factor(); 43 device_scale_factor_ = display.device_scale_factor();
45 rotation_ = display.rotation();
46 if (platform_cursor_) 44 if (platform_cursor_)
47 ui::UnrefCustomXCursor(platform_cursor_); 45 ui::UnrefCustomXCursor(platform_cursor_);
48 platform_cursor_ = 0; 46 platform_cursor_ = 0;
49 // It is not necessary to recreate platform_cursor_ yet, since it will be 47 // It is not necessary to recreate platform_cursor_ yet, since it will be
50 // recreated on demand when GetPlatformCursor is called. 48 // recreated on demand when GetPlatformCursor is called.
51 } 49 }
52 50
53 void WebCursor::InitPlatformData() { 51 void WebCursor::InitPlatformData() {
54 platform_cursor_ = 0; 52 platform_cursor_ = 0;
55 device_scale_factor_ = 1.f; 53 device_scale_factor_ = 1.f;
56 rotation_ = gfx::Display::ROTATE_0;
57 } 54 }
58 55
59 bool WebCursor::SerializePlatformData(Pickle* pickle) const { 56 bool WebCursor::SerializePlatformData(Pickle* pickle) const {
60 return true; 57 return true;
61 } 58 }
62 59
63 bool WebCursor::DeserializePlatformData(PickleIterator* iter) { 60 bool WebCursor::DeserializePlatformData(PickleIterator* iter) {
64 return true; 61 return true;
65 } 62 }
66 63
(...skipping 12 matching lines...) Expand all
79 if (platform_cursor_) 76 if (platform_cursor_)
80 ui::UnrefCustomXCursor(platform_cursor_); 77 ui::UnrefCustomXCursor(platform_cursor_);
81 platform_cursor_ = other.platform_cursor_; 78 platform_cursor_ = other.platform_cursor_;
82 if (platform_cursor_) 79 if (platform_cursor_)
83 ui::RefCustomXCursor(platform_cursor_); 80 ui::RefCustomXCursor(platform_cursor_);
84 81
85 device_scale_factor_ = other.device_scale_factor_; 82 device_scale_factor_ = other.device_scale_factor_;
86 } 83 }
87 84
88 } // namespace content 85 } // namespace content
OLDNEW
« no previous file with comments | « content/common/cursors/webcursor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698