Ticket #4720: wallpaper-fix.2.diff
File wallpaper-fix.2.diff, 4.0 KB (added by , 14 years ago) |
---|
-
src/preferences/backgrounds/BackgroundImage.cpp
299 299 // else fall thru 300 300 case kScaledToFit: 301 301 if (fIsDesktop) { 302 destinationBitmapBounds = viewBounds; 302 if (BRectRatio(destinationBitmapBounds) 303 >= BRectRatio(viewBounds)) { 304 float overlap = BRectHorizontalOverlap(viewBounds, 305 destinationBitmapBounds); 306 destinationBitmapBounds.Set(-overlap, 0, 307 viewBounds.Width() + overlap, viewBounds.Height()); 308 } else { 309 float overlap = BRectVerticalOverlap(viewBounds, 310 destinationBitmapBounds); 311 destinationBitmapBounds.Set(0, -overlap, 312 viewBounds.Width(), viewBounds.Height() + overlap); 313 } 303 314 followFlags = B_FOLLOW_ALL; 304 315 break; 305 316 } … … 334 345 } 335 346 336 347 348 float 349 BackgroundImage::BRectRatio(BRect rect) 350 { 351 return rect.Width() / rect.Height(); 352 } 353 354 355 float 356 BackgroundImage::BRectHorizontalOverlap(BRect hostRect, BRect resizedRect) 357 { 358 return (((hostRect.Height() / resizedRect.Height()) 359 * resizedRect.Width()) - hostRect.Height()) / 2; 360 } 361 362 363 float 364 BackgroundImage::BRectVerticalOverlap(BRect hostRect, BRect resizedRect) 365 { 366 return (((hostRect.Width() / resizedRect.Width()) 367 * resizedRect.Height()) - hostRect.Width()) / 2; 368 } 369 370 337 371 void 338 372 BackgroundImage::Remove() 339 373 { -
src/preferences/backgrounds/BackgroundImage.h
139 139 // no public constructor, GetBackgroundImage factory function is 140 140 // used instead 141 141 142 float BRectRatio(BRect rect); 143 float BRectHorizontalOverlap(BRect hostRect, BRect resizedRect); 144 float BRectVerticalOverlap(BRect hostRect, BRect resizedRect); 145 142 146 bool fIsDesktop; 143 147 BNode fDefinedByNode; 144 148 BView* fView; -
src/kits/tracker/BackgroundImage.cpp
199 199 // else fall thru 200 200 case kScaledToFit: 201 201 if (fIsDesktop) { 202 destinationBitmapBounds = viewBounds; 202 if (BRectRatio(destinationBitmapBounds) 203 >= BRectRatio(viewBounds)) { 204 float overlap = BRectHorizontalOverlap(viewBounds, 205 destinationBitmapBounds); 206 destinationBitmapBounds.Set(-overlap, 0, 207 viewBounds.Width() + overlap, viewBounds.Height()); 208 } else { 209 float overlap = BRectVerticalOverlap(viewBounds, 210 destinationBitmapBounds); 211 destinationBitmapBounds.Set(0, -overlap, 212 viewBounds.Width(), viewBounds.Height() + overlap); 213 } 203 214 followFlags = B_FOLLOW_ALL; 204 215 break; 205 216 } … … 224 235 fShowingBitmap = info; 225 236 } 226 237 238 239 float 240 BackgroundImage::BRectRatio(BRect rect) 241 { 242 return rect.Width() / rect.Height(); 243 } 244 245 246 float 247 BackgroundImage::BRectHorizontalOverlap(BRect hostRect, BRect resizedRect) 248 { 249 return (((hostRect.Height() / resizedRect.Height()) 250 * resizedRect.Width()) - hostRect.Height()) / 2; 251 } 252 253 254 float 255 BackgroundImage::BRectVerticalOverlap(BRect hostRect, BRect resizedRect) 256 { 257 return (((hostRect.Width() / resizedRect.Width()) 258 * resizedRect.Height()) - hostRect.Width()) / 2; 259 } 260 261 227 262 void 228 263 BackgroundImage::Remove() 229 264 { -
src/kits/tracker/BackgroundImage.h
115 115 116 116 void Add(BackgroundImageInfo *); 117 117 118 float BRectRatio(BRect rect); 119 float BRectHorizontalOverlap(BRect hostRect, BRect resizedRect); 120 float BRectVerticalOverlap(BRect hostRect, BRect resizedRect); 121 118 122 bool fIsDesktop; 119 123 BNode fDefinedByNode; 120 124 BView *fView;