|
Lines 400-416
static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(CocoaImage *
a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm_sec1
|
| 400 |
auto graphicsContext = bitmap->createGraphicsContext(); |
400 |
auto graphicsContext = bitmap->createGraphicsContext(); |
| 401 |
if (!graphicsContext) |
401 |
if (!graphicsContext) |
| 402 |
return nullptr; |
402 |
return nullptr; |
|
|
403 |
|
| 403 |
#if PLATFORM(IOS_FAMILY) |
404 |
#if PLATFORM(IOS_FAMILY) |
| 404 |
UIGraphicsPushContext(graphicsContext->platformContext()); |
405 |
UIGraphicsPushContext(graphicsContext->platformContext()); |
| 405 |
[image drawInRect:CGRectMake(0, 0, bitmap->size().width(), bitmap->size().height())]; |
406 |
[image drawInRect:CGRectMake(0, 0, bitmap->size().width(), bitmap->size().height())]; |
| 406 |
UIGraphicsPopContext(); |
407 |
UIGraphicsPopContext(); |
| 407 |
#elif PLATFORM(MAC) |
408 |
#elif USE(APPKIT) |
| 408 |
auto savedContext = retainPtr([NSGraphicsContext currentContext]); |
409 |
{ |
| 409 |
|
410 |
LocalCurrentGraphicsContext savedContext(*graphicsContext); |
| 410 |
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:graphicsContext->platformContext() flipped:YES]]; |
411 |
[image drawInRect:NSMakeRect(0, 0, bitmap->size().width(), bitmap->size().height()) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil]; |
| 411 |
[image drawInRect:NSMakeRect(0, 0, bitmap->size().width(), bitmap->size().height()) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil]; |
412 |
} |
| 412 |
|
|
|
| 413 |
[NSGraphicsContext setCurrentContext:savedContext.get()]; |
| 414 |
#endif |
413 |
#endif |
| 415 |
return bitmap; |
414 |
return bitmap; |
| 416 |
} |
415 |
} |