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

Side by Side Diff: webkit/glue/webcursor_aurax11.cc

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/size_f.cc ('k') | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('j') | 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 "webkit/glue/webcursor.h" 5 #include "webkit/glue/webcursor.h"
6 6
7 #include <X11/Xcursor/Xcursor.h> 7 #include <X11/Xcursor/Xcursor.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/cursorfont.h> 9 #include <X11/cursorfont.h>
10 10
(...skipping 13 matching lines...) Expand all
24 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 24 bitmap.setConfig(SkBitmap::kARGB_8888_Config,
25 custom_size_.width(), custom_size_.height()); 25 custom_size_.width(), custom_size_.height());
26 bitmap.allocPixels(); 26 bitmap.allocPixels();
27 memcpy(bitmap.getAddr32(0, 0), custom_data_.data(), custom_data_.size()); 27 memcpy(bitmap.getAddr32(0, 0), custom_data_.data(), custom_data_.size());
28 28
29 XcursorImage* image = NULL; 29 XcursorImage* image = NULL;
30 if (scale_factor_ == 1.f) { 30 if (scale_factor_ == 1.f) {
31 image = ui::SkBitmapToXcursorImage(&bitmap, hotspot_); 31 image = ui::SkBitmapToXcursorImage(&bitmap, hotspot_);
32 } else { 32 } else {
33 gfx::Size scaled_size = gfx::ToFlooredSize( 33 gfx::Size scaled_size = gfx::ToFlooredSize(
34 custom_size_.Scale(scale_factor_)); 34 gfx::ScaleSize(custom_size_, scale_factor_));
35 SkBitmap scaled_bitmap = skia::ImageOperations::Resize(bitmap, 35 SkBitmap scaled_bitmap = skia::ImageOperations::Resize(bitmap,
36 skia::ImageOperations::RESIZE_BETTER, 36 skia::ImageOperations::RESIZE_BETTER,
37 scaled_size.width(), 37 scaled_size.width(),
38 scaled_size.height()); 38 scaled_size.height());
39 gfx::Point hotspot_point = gfx::ToFlooredPoint( 39 gfx::Point hotspot_point = gfx::ToFlooredPoint(
40 gfx::ScalePoint(hotspot_, scale_factor_)); 40 gfx::ScalePoint(hotspot_, scale_factor_));
41 image = ui::SkBitmapToXcursorImage(&scaled_bitmap, hotspot_point); 41 image = ui::SkBitmapToXcursorImage(&scaled_bitmap, hotspot_point);
42 } 42 }
43 platform_cursor_ = ui::CreateReffedCustomXCursor(image); 43 platform_cursor_ = ui::CreateReffedCustomXCursor(image);
44 return platform_cursor_; 44 return platform_cursor_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 void WebCursor::CopyPlatformData(const WebCursor& other) { 83 void WebCursor::CopyPlatformData(const WebCursor& other) {
84 if (platform_cursor_) 84 if (platform_cursor_)
85 ui::UnrefCustomXCursor(platform_cursor_); 85 ui::UnrefCustomXCursor(platform_cursor_);
86 platform_cursor_ = other.platform_cursor_; 86 platform_cursor_ = other.platform_cursor_;
87 if (platform_cursor_) 87 if (platform_cursor_)
88 ui::RefCustomXCursor(platform_cursor_); 88 ui::RefCustomXCursor(platform_cursor_);
89 89
90 scale_factor_ = other.scale_factor_; 90 scale_factor_ = other.scale_factor_;
91 } 91 }
OLDNEW
« no previous file with comments | « ui/gfx/size_f.cc ('k') | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698