Changeset 57621 in webkit


Ignore:
Timestamp:
Apr 14, 2010 5:46:34 PM (14 years ago)
Author:
andersca@apple.com
Message:

2010-04-14 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Fix horizontal scrollbar repainting
https://bugs.webkit.org/show_bug.cgi?id=37626

Make sure that the update chunk is flipped because that's what WebCore expects.


  • Shared/mac/UpdateChunk.cpp: (WebKit::UpdateChunk::createImage):
  • Shared/mac/UpdateChunk.h: Add new createImage member function that creates a CGImageRef from the update chunk.


  • UIProcess/mac/DrawingAreaProxyUpdateChunk.mm: (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore): Pass the right rectangle here; CoreGraphics wants it in non-flipped coordinates.


(WebKit::DrawingAreaProxyUpdateChunk::ensureBackingStore):
Create a flipped backing store.

  • WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp: (WebKit::DrawingAreaUpdateChunk::paintIntoUpdateChunk): Flip the update chunk.
Location:
trunk/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r57605 r57621  
     12010-04-14  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Fix horizontal scrollbar repainting
     6        https://bugs.webkit.org/show_bug.cgi?id=37626
     7
     8        Make sure that the update chunk is flipped because that's what WebCore expects.
     9       
     10        * Shared/mac/UpdateChunk.cpp:
     11        (WebKit::UpdateChunk::createImage):
     12        * Shared/mac/UpdateChunk.h:
     13        Add new createImage member function that creates a CGImageRef from the update chunk.
     14       
     15        * UIProcess/mac/DrawingAreaProxyUpdateChunk.mm:
     16        (WebKit::DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore):
     17        Pass the right rectangle here; CoreGraphics wants it in non-flipped coordinates.
     18       
     19        (WebKit::DrawingAreaProxyUpdateChunk::ensureBackingStore):
     20        Create a flipped backing store.
     21
     22        * WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp:
     23        (WebKit::DrawingAreaUpdateChunk::paintIntoUpdateChunk):
     24        Flip the update chunk.
     25
    1262010-04-14  Sam Weinig  <sam@webkit.org>
    227
  • trunk/WebKit2/Shared/mac/UpdateChunk.cpp

    r57375 r57621  
    5757}
    5858
    59 void UpdateChunk::drawIntoContext(CGContextRef context)
     59RetainPtr<CGImageRef> UpdateChunk::createImage()
    6060{
    6161    RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithData(0, m_data, size(), 0));
    6262    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
    6363    RetainPtr<CGImageRef> image(AdoptCF, CGImageCreate(m_rect.width(), m_rect.height(), 8, 32, m_rect.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedLast, provider.get(), 0, false, kCGRenderingIntentDefault));
    64 
    65     CGContextDrawImage(context, CGRectMake(m_rect.x(), m_rect.y(), m_rect.width(), m_rect.height()), image.get());
     64   
     65    return image;
    6666}
    6767
  • trunk/WebKit2/Shared/mac/UpdateChunk.h

    r57308 r57621  
    2828
    2929#include <WebCore/IntRect.h>
     30#include <wtf/RetainPtr.h>
    3031
    3132namespace CoreIPC {
     
    4243    ~UpdateChunk();
    4344
    44     void drawIntoContext(CGContextRef);
    45 
    4645    uint8_t* data() { return m_data; }
    4746    const WebCore::IntRect& rect() const { return m_rect; }
     
    5049    static bool decode(CoreIPC::ArgumentDecoder&, UpdateChunk&);
    5150
     51    RetainPtr<CGImageRef> createImage();
     52   
    5253private:
    5354    size_t size() const { return m_rect.width() * 4 * m_rect.height(); }
  • trunk/WebKit2/UIProcess/mac/DrawingAreaProxyUpdateChunk.h

    r57310 r57621  
    5858
    5959private:
    60     void drawUpdateChunkIntoBackingStore(UpdateChunk&);
     60    void drawUpdateChunkIntoBackingStore(UpdateChunk*);
    6161    void ensureBackingStore();
    6262
    63     void didSetSize(const WebCore::IntSize& viewSize, UpdateChunk& updateChunk);
     63    void didSetSize(const WebCore::IntSize& viewSize, UpdateChunk* updateChunk);
    6464
    6565    bool m_isInitialized;
  • trunk/WebKit2/UIProcess/mac/DrawingAreaProxyUpdateChunk.mm

    r57310 r57621  
    5353}
    5454
    55 void DrawingAreaProxyUpdateChunk::drawRectIntoContext(CGRect, CGContextRef context)
     55void DrawingAreaProxyUpdateChunk::drawRectIntoContext(CGRect rect, CGContextRef context)
    5656{
    5757    if (!m_isInitialized) {
     
    7777}
    7878
    79 void DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore(UpdateChunk& updateChunk)
     79void DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk)
    8080{
    8181    ensureBackingStore();
    8282
    83     updateChunk.drawIntoContext(m_bitmapContext.get());
    84     [m_webView setNeedsDisplayInRect:NSRectFromCGRect((CGRect)updateChunk.rect())];
     83    RetainPtr<CGImageRef> image(updateChunk->createImage());
     84    const IntRect& updateChunkRect = updateChunk->rect();
     85   
     86    CGContextDrawImage(m_bitmapContext.get(), CGRectMake(updateChunkRect.x(), m_viewSize.height() - updateChunkRect.bottom(),
     87                                                         updateChunkRect.width(), updateChunkRect.height()), image.get());
     88    [m_webView setNeedsDisplayInRect:NSRectFromCGRect(updateChunkRect)];
    8589}
    8690
     
    9296    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
    9397    m_bitmapContext.adoptCF(CGBitmapContextCreate(0, m_viewSize.width(), m_viewSize.height(), 8, m_viewSize.width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedLast));
     98   
     99    // Flip the bitmap context coordinate system.
     100    CGContextTranslateCTM(m_bitmapContext.get(), 0, m_viewSize.height());
     101    CGContextScaleCTM(m_bitmapContext.get(), 1, -1);
    94102}
    95103
     
    113121}
    114122
    115 void DrawingAreaProxyUpdateChunk::didSetSize(const IntSize& viewSize, UpdateChunk& updateChunk)
     123void DrawingAreaProxyUpdateChunk::didSetSize(const IntSize& viewSize, UpdateChunk* updateChunk)
    116124{
    117125    ASSERT(m_isWaitingForDidSetFrameNotification);
     
    136144            if (!arguments.decode(updateChunk))
    137145                return;
    138             drawUpdateChunkIntoBackingStore(updateChunk);
     146            drawUpdateChunkIntoBackingStore(&updateChunk);
    139147            break;
    140148        }
     
    145153                return;
    146154
    147             didSetSize(viewSize, updateChunk);
     155            didSetSize(viewSize, &updateChunk);
    148156            break;
    149157        }
  • trunk/WebKit2/WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp

    r57596 r57621  
    8282    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
    8383    RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreate(updateChunk->data(), updateChunk->rect().width(), updateChunk->rect().height(), 8, updateChunk->rect().width() * 4, colorSpace.get(), kCGImageAlphaPremultipliedLast));
    84    
     84
     85    // WebCore expects a flipped coordinate system.
     86    CGContextTranslateCTM(bitmapContext.get(), 0.0, updateChunk->rect().height());
     87    CGContextScaleCTM(bitmapContext.get(), 1.0, -1.0);
     88
    8589    // Now paint into the backing store.
    8690    GraphicsContext graphicsContext(bitmapContext.get());
Note: See TracChangeset for help on using the changeset viewer.