Changeset 21322 in webkit


Ignore:
Timestamp:
May 8, 2007 9:09:24 PM (17 years ago)
Author:
bdash
Message:

2007-05-08 Bruce Q Hammond <bruceq@apple.com>

Reviewed by Darin.

http://bugs.webkit.org/show_bug.cgi?id=13578
Bug 13578: When QD plugins draw to an offscreen bitmap the origin is not correct

Now we have correct handling of the origin when QD plugins draw to
offscreen bitmaps.
Also the clipping code for this path was doing unnecessary work which
caused incorrect results; it has been removed.


This change should not affect Safari and in general will only affect
plugins (e.g. Flash) drawing to a CGBitmapContext.

  • Plugins/WebBaseNetscapePluginView.mm: (-[WebBaseNetscapePluginView saveAndSetNewPortStateForUpdate:]):
Location:
trunk/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r21318 r21322  
     12007-05-08  Bruce Q Hammond  <bruceq@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=13578
     6        Bug 13578: When QD plugins draw to an offscreen bitmap the origin is not correct
     7
     8        Now we have correct handling of the origin when QD plugins draw to
     9        offscreen bitmaps.
     10        Also the clipping code for this path was doing unnecessary work which
     11        caused incorrect results; it has been removed.
     12       
     13        This change should not affect Safari and in general will only affect
     14        plugins (e.g. Flash) drawing to a CGBitmapContext.
     15
     16        * Plugins/WebBaseNetscapePluginView.mm:
     17        (-[WebBaseNetscapePluginView saveAndSetNewPortStateForUpdate:]):
     18
    1192007-05-08  Steve Falkenburg  <sfalken@apple.com>
    220
     
    19181936        (HIWebViewEventHandler): Don't leak the NSEvent.
    19191937
    1920 2007-03-08  Bruce Q Hammond  <bruceq@apple.om>
     19382007-03-08  Bruce Q Hammond  <bruceq@apple.com>
    19211939
    19221940        Reviewed by Darin.
  • trunk/WebKit/Plugins/WebBaseNetscapePluginView.mm

    r21223 r21322  
    445445                        nPort.qdPort.port = port;
    446446                        boundsInWindow = [self bounds];
    447                         nPort.qdPort.portx = (int32)-boundsInWindow.origin.x;
    448                         nPort.qdPort.porty = (int32)-boundsInWindow.origin.y;
     447                       
     448                        // Generate a QD origin based on the current affine transform for currentContext.
     449                        CGAffineTransform offscreenMatrix = CGContextGetCTM(currentContext);
     450                        CGPoint origin = {0,0};
     451                        CGPoint axisFlip = {1,1};
     452                        origin = CGPointApplyAffineTransform(origin, offscreenMatrix);
     453                        axisFlip = CGPointApplyAffineTransform(axisFlip, offscreenMatrix);
     454                       
     455                        // Quartz bitmaps have origins at the bottom left, but the axes may be inverted, so handle that.
     456                        origin.x = offscreenBounds.left - origin.x * (axisFlip.x - origin.x);
     457                        origin.y = offscreenBounds.bottom + origin.y * (axisFlip.y - origin.y);
     458                       
     459                        nPort.qdPort.portx = (int32)-boundsInWindow.origin.x + origin.x;
     460                        nPort.qdPort.porty = (int32)-boundsInWindow.origin.y + origin.y;                       
    449461                        window.x = 0;
    450462                        window.y = 0;
     
    464476            // Clip to dirty region so plug-in does not draw over already-drawn regions of the window that are
    465477            // not going to be redrawn this update.  This forces plug-ins to play nice with z-index ordering.
    466             Rect clipBounds;
    467478            if (forUpdate) {
    468479                RgnHandle viewClipRegion = NewRgn();
     
    492503                SectRgn(clipRegion, viewClipRegion, clipRegion);
    493504                DisposeRgn(viewClipRegion);
    494                 if (port == offscreenGWorld) {
    495                     GetRegionBounds(clipRegion, &clipBounds);
    496                     OffsetRgn(clipRegion, -clipBounds.left, -clipBounds.top);
    497                 }
    498505            }
    499506
     
    511518                // We reset the port's visible region to counteract what BeginUpdate did.
    512519                SetPortVisibleRegion(nPort.qdPort.port, clipRegion);
    513 
    514                 // Some plugins do their own BeginUpdate/EndUpdate.
    515                 // For those, we must make sure that the update region contains the area we want to draw.
    516                 if (port == offscreenGWorld)
    517                     OffsetRgn(clipRegion, clipBounds.left, clipBounds.top);
    518520                InvalWindowRgn(windowRef, clipRegion);
    519521            }
Note: See TracChangeset for help on using the changeset viewer.