mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 339548. Part 8: Create nsPoint::ToNearestPixels. r=dbaron
This commit is contained in:
parent
12c9748167
commit
94c4cbe089
@ -40,6 +40,8 @@
|
||||
|
||||
#include "nsCoord.h"
|
||||
|
||||
struct nsIntPoint;
|
||||
|
||||
struct nsPoint {
|
||||
nscoord x, y;
|
||||
|
||||
@ -79,6 +81,8 @@ struct nsPoint {
|
||||
nsPoint operator-() const {
|
||||
return nsPoint(-x, -y);
|
||||
}
|
||||
|
||||
inline nsIntPoint ToNearestPixels(nscoord aAppUnitsPerPixel) const;
|
||||
};
|
||||
|
||||
struct nsIntPoint {
|
||||
@ -117,4 +121,11 @@ struct nsIntPoint {
|
||||
void MoveTo(PRInt32 aX, PRInt32 aY) {x = aX; y = aY;}
|
||||
};
|
||||
|
||||
inline nsIntPoint
|
||||
nsPoint::ToNearestPixels(nscoord aAppUnitsPerPixel) const {
|
||||
return nsIntPoint(
|
||||
NSToIntRound(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel))),
|
||||
NSToIntRound(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel))));
|
||||
}
|
||||
|
||||
#endif /* NSPOINT_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user