Skip to content

Commit

Permalink
fixed WebView.m not to recreate the bitmap for every frame.
Browse files Browse the repository at this point in the history
  • Loading branch information
KojiNakamaru committed Sep 1, 2015
1 parent 869df13 commit 6d63392
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions plugins/Mac/Sources/WebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,18 @@ - (void)update:(int)x y:(int)y deltaY:(float)deltaY buttonDown:(BOOL)buttonDown
[view scrollWheel:scrollEvent];
}

@synchronized(bitmap) {
@synchronized(self) {
if (bitmap == nil)
bitmap = [[webView bitmapImageRepForCachingDisplayInRect:webView.frame] retain];
memset([bitmap bitmapData], 0, [bitmap bytesPerRow] * [bitmap pixelsHigh]);
[webView cacheDisplayInRect:webView.frame toBitmapImageRep:bitmap];
needsDisplay = YES; // TODO (bitmap == nil || [view needsDisplay]);
if (needsDisplay) {
[bitmap release];
bitmap = [[webView
bitmapImageRepForCachingDisplayInRect:[webView visibleRect]] retain];
[webView cacheDisplayInRect:[webView visibleRect]
toBitmapImageRep:bitmap];
}
}
}

- (void)render
{
@synchronized(bitmap) {
@synchronized(self) {
if (!needsDisplay)
return;

Expand Down

0 comments on commit 6d63392

Please sign in to comment.