Changeset 31233 in vbox
- Timestamp:
- Jul 30, 2010 10:00:01 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp
r31214 r31233 246 246 /* Create a subimage of the current view in the size 247 247 * of the bounding box of the current paint event */ 248 QRect qir = aEvent->rect(); 249 CGRect ir = ::darwinToCGRect(qir); 250 CGRect is = CGRectMake(qir.x() + m_pMachineView->contentsX(), qir.y() + m_pMachineView->contentsY(), qir.width(), qir.height()); 251 ir = ::darwinFlipCGRect(ir, CGRectGetHeight(viewRect)); 248 CGRect ir = ::darwinToCGRect(aEvent->rect()); 249 CGRect is = CGRectMake(CGRectGetMinX(ir) + m_pMachineView->contentsX(), CGRectGetMinY(ir) + m_pMachineView->contentsY(), CGRectGetWidth(ir), CGRectGetHeight(ir)); 250 252 251 double iw = 1.0; 253 252 double ih = 1.0; … … 267 266 iw = (double)CGImageGetWidth(m_image) / m_scaledSize.width(); 268 267 ih = (double)CGImageGetHeight(m_image) / m_scaledSize.height(); 269 is.origin.x = (double)(is.origin.x * iw); 270 is.origin.y = (double)(is.origin.y * ih); 271 is.size.width = (double)(is.size.width * iw); 272 is.size.height = (double)(is.size.height * ih); 273 ir.origin.x = (double)(ir.origin.x * iw); 274 ir.origin.y = (double)(ir.origin.y * ih); 275 ir.size.width = (double)(ir.size.width * iw); 276 ir.size.height = (double)(ir.size.height * ih); 268 /* We make sure the image is always bigger than requested to 269 * compensate rounding errors. */ 270 /* Round down */ 271 is.origin.x = (int)(is.origin.x * iw); 272 is.origin.y = (int)(is.origin.y * ih); 273 /* Round up */ 274 is.size.width = (int)(is.size.width * iw) + 2; 275 is.size.height = (int)(is.size.height * ih) + 2; 276 /* Make sure the size is within the image boundaries */ 277 is = CGRectIntersection(is, CGRectMake(0, 0, CGImageGetWidth(m_image), CGImageGetHeight(m_image))); 278 /* Cause we probably changed the rectangle to update in the origin 279 * coordinate system, we have to recalculate the update rectangle 280 * for the screen coordinates as well. Please note that this has to 281 * be in double precision. */ 282 ir.origin.x = is.origin.x / iw; 283 ir.origin.y = is.origin.y / ih; 284 ir.size.width = is.size.width / iw; 285 ir.size.height = is.size.height / ih; 286 /* Create the sub image */ 277 287 subImage = CGImageCreateWithImageInRect(m_image, is); 278 288 } … … 291 301 CGContextClip(ctx); 292 302 } 293 294 303 /* In any case clip the drawing to the view window */ 295 304 CGContextClipToRect(ctx, viewRect); 296 305 /* Turn the high interpolation quality on. */ 297 306 CGContextSetInterpolationQuality(ctx, kCGInterpolationHigh); 298 CGContextScaleCTM(ctx, 1.0 / iw, 1.0 / ih);299 307 /* Draw the image. */ 300 CGContextDrawImage(ctx, ir, subImage); 308 309 CGContextDrawImage(ctx, ::darwinFlipCGRect(ir, CGRectGetHeight(viewRect)), subImage); 301 310 CGImageRelease(subImage); 302 311 }
Note:
See TracChangeset
for help on using the changeset viewer.

