OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (imageRect.contains(specifiedHotSpot)) { | 40 if (imageRect.contains(specifiedHotSpot)) { |
41 return specifiedHotSpot; | 41 return specifiedHotSpot; |
42 } | 42 } |
43 | 43 |
44 return IntPoint( | 44 return IntPoint( |
45 clampTo<int>(specifiedHotSpot.x(), imageRect.x(), imageRect.maxX() - 1), | 45 clampTo<int>(specifiedHotSpot.x(), imageRect.x(), imageRect.maxX() - 1), |
46 clampTo<int>(specifiedHotSpot.y(), imageRect.y(), | 46 clampTo<int>(specifiedHotSpot.y(), imageRect.y(), |
47 imageRect.maxY() - 1)); | 47 imageRect.maxY() - 1)); |
48 } | 48 } |
49 | 49 |
50 // If hot spot is not specified externally, it can be extracted from some imag
e formats (e.g. .cur). | 50 // If hot spot is not specified externally, it can be extracted from some |
| 51 // image formats (e.g. .cur). |
51 IntPoint intrinsicHotSpot; | 52 IntPoint intrinsicHotSpot; |
52 bool imageHasIntrinsicHotSpot = image->getHotSpot(intrinsicHotSpot); | 53 bool imageHasIntrinsicHotSpot = image->getHotSpot(intrinsicHotSpot); |
53 if (imageHasIntrinsicHotSpot && imageRect.contains(intrinsicHotSpot)) | 54 if (imageHasIntrinsicHotSpot && imageRect.contains(intrinsicHotSpot)) |
54 return intrinsicHotSpot; | 55 return intrinsicHotSpot; |
55 | 56 |
56 // If neither is provided, use a default value of (0, 0). | 57 // If neither is provided, use a default value of (0, 0). |
57 return IntPoint(); | 58 return IntPoint(); |
58 } | 59 } |
59 | 60 |
60 Cursor::Cursor(Image* image, bool hotSpotSpecified, const IntPoint& hotSpot) | 61 Cursor::Cursor(Image* image, bool hotSpotSpecified, const IntPoint& hotSpot) |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 DEFINE_STATIC_LOCAL(Cursor, c, (Cursor::Grab)); | 300 DEFINE_STATIC_LOCAL(Cursor, c, (Cursor::Grab)); |
300 return c; | 301 return c; |
301 } | 302 } |
302 | 303 |
303 const Cursor& grabbingCursor() { | 304 const Cursor& grabbingCursor() { |
304 DEFINE_STATIC_LOCAL(Cursor, c, (Cursor::Grabbing)); | 305 DEFINE_STATIC_LOCAL(Cursor, c, (Cursor::Grabbing)); |
305 return c; | 306 return c; |
306 } | 307 } |
307 | 308 |
308 } // namespace blink | 309 } // namespace blink |
OLD | NEW |