Magnify: some 64 bit fixes

This commit is contained in:
Jérôme Duval
2013-05-04 15:31:06 +02:00
parent 55a4a88045
commit cf91714bf2
2 changed files with 15 additions and 12 deletions
+14 -11
View File
@@ -873,8 +873,8 @@ TInfoView::Draw(BRect updateRect)
float h = Bounds().Height(); float h = Bounds().Height();
if (ch2Showing) { if (ch2Showing) {
MovePenTo(10, h-12); MovePenTo(10, h-12);
sprintf(str, "2) x: %li y: %li y: %i", (int32)pt2.x, (int32)pt2.y, sprintf(str, "2) x: %" B_PRIi32 " y: %" B_PRIi32 " y: %d",
abs((int)(pt1.y - pt2.y))); (int32)pt2.x, (int32)pt2.y, abs((int)(pt1.y - pt2.y)));
invalRect.Set(10, h-12-fFontHeight, 10 + StringWidth(fCH2Str), h-10); invalRect.Set(10, h-12-fFontHeight, 10 + StringWidth(fCH2Str), h-10);
SetHighColor(ViewColor()); SetHighColor(ViewColor());
FillRect(invalRect); FillRect(invalRect);
@@ -886,8 +886,8 @@ TInfoView::Draw(BRect updateRect)
if (ch1Showing && ch2Showing) { if (ch1Showing && ch2Showing) {
MovePenTo(10, h-10-fFontHeight-2); MovePenTo(10, h-10-fFontHeight-2);
sprintf(str, "1) x: %li y: %li x: %i", (int32)pt1.x, (int32)pt1.y, sprintf(str, "1) x: %" B_PRIi32 " y: %" B_PRIi32 " x: %d",
abs((int)(pt1.x - pt2.x))); (int32)pt1.x, (int32)pt1.y, abs((int)(pt1.x - pt2.x)));
invalRect.Set(10, h-10-2*fFontHeight-2, 10 + StringWidth(fCH1Str), h-10-fFontHeight); invalRect.Set(10, h-10-2*fFontHeight-2, 10 + StringWidth(fCH1Str), h-10-fFontHeight);
SetHighColor(ViewColor()); SetHighColor(ViewColor());
FillRect(invalRect); FillRect(invalRect);
@@ -897,7 +897,7 @@ TInfoView::Draw(BRect updateRect)
DrawString(fCH1Str); DrawString(fCH1Str);
} else if (ch1Showing) { } else if (ch1Showing) {
MovePenTo(10, h-10); MovePenTo(10, h-10);
sprintf(str, "x: %li y: %li", (int32)pt1.x, (int32)pt1.y); sprintf(str, "x: %" B_PRIi32 " y: %" B_PRIi32, (int32)pt1.x, (int32)pt1.y);
invalRect.Set(10, h-10-fFontHeight, 10 + StringWidth(fCH1Str), h-8); invalRect.Set(10, h-10-fFontHeight, 10 + StringWidth(fCH1Str), h-8);
SetHighColor(ViewColor()); SetHighColor(ViewColor());
FillRect(invalRect); FillRect(invalRect);
@@ -1410,7 +1410,7 @@ void
TMagnify::NudgeMouse(float x, float y) TMagnify::NudgeMouse(float x, float y)
{ {
BPoint loc; BPoint loc;
ulong button; uint32 button;
GetMouse(&loc, &button); GetMouse(&loc, &button);
ConvertToScreen(&loc); ConvertToScreen(&loc);
@@ -1429,7 +1429,7 @@ TMagnify::WindowActivated(bool active)
} }
long status_t
TMagnify::MagnifyTask(void *arg) TMagnify::MagnifyTask(void *arg)
{ {
TMagnify* view = (TMagnify*)arg; TMagnify* view = (TMagnify*)arg;
@@ -1456,7 +1456,7 @@ void
TMagnify::Update(bool force) TMagnify::Update(bool force)
{ {
BPoint loc; BPoint loc;
ulong button; uint32 button;
static long counter = 0; static long counter = 0;
if (!fStickCoordinates) { if (!fStickCoordinates) {
@@ -1697,11 +1697,14 @@ TMagnify::SaveBits(BFile* file, const BBitmap *bitmap, const char* name) const
char str[1024]; char str[1024];
// stream out the width, height and ColorSpace // stream out the width, height and ColorSpace
sprintf(str, "const int32 k%sWidth = %ld;\n", name, (int32)bitmap->Bounds().Width()+1); sprintf(str, "const int32 k%sWidth = %" B_PRIi32 ";\n", name,
(int32)bitmap->Bounds().Width()+1);
file->Write(str, strlen(str)); file->Write(str, strlen(str));
sprintf(str, "const int32 k%sHeight = %ld;\n", name, (int32)bitmap->Bounds().Height()+1); sprintf(str, "const int32 k%sHeight = %" B_PRIi32 ";\n", name,
(int32)bitmap->Bounds().Height()+1);
file->Write(str, strlen(str)); file->Write(str, strlen(str));
sprintf(str, "const color_space k%sColorSpace = %s;\n\n", name, kColorSpaceName); sprintf(str, "const color_space k%sColorSpace = %s;\n\n", name,
kColorSpaceName);
file->Write(str, strlen(str)); file->Write(str, strlen(str));
// stream out the constant name for this array // stream out the constant name for this array
+1 -1
View File
@@ -119,7 +119,7 @@ class TMagnify : public BView {
void EndSave(); void EndSave();
private: private:
static long MagnifyTask(void *); static status_t MagnifyTask(void *);
bool fNeedToUpdate; bool fNeedToUpdate;
long fThread; // magnify thread id long fThread; // magnify thread id