Changeset 57621 in webkit
- Timestamp:
- Apr 14, 2010 5:46:34 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r57605 r57621 1 2010-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 1 26 2010-04-14 Sam Weinig <sam@webkit.org> 2 27 -
trunk/WebKit2/Shared/mac/UpdateChunk.cpp
r57375 r57621 57 57 } 58 58 59 void UpdateChunk::drawIntoContext(CGContextRef context)59 RetainPtr<CGImageRef> UpdateChunk::createImage() 60 60 { 61 61 RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithData(0, m_data, size(), 0)); 62 62 RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); 63 63 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; 66 66 } 67 67 -
trunk/WebKit2/Shared/mac/UpdateChunk.h
r57308 r57621 28 28 29 29 #include <WebCore/IntRect.h> 30 #include <wtf/RetainPtr.h> 30 31 31 32 namespace CoreIPC { … … 42 43 ~UpdateChunk(); 43 44 44 void drawIntoContext(CGContextRef);45 46 45 uint8_t* data() { return m_data; } 47 46 const WebCore::IntRect& rect() const { return m_rect; } … … 50 49 static bool decode(CoreIPC::ArgumentDecoder&, UpdateChunk&); 51 50 51 RetainPtr<CGImageRef> createImage(); 52 52 53 private: 53 54 size_t size() const { return m_rect.width() * 4 * m_rect.height(); } -
trunk/WebKit2/UIProcess/mac/DrawingAreaProxyUpdateChunk.h
r57310 r57621 58 58 59 59 private: 60 void drawUpdateChunkIntoBackingStore(UpdateChunk &);60 void drawUpdateChunkIntoBackingStore(UpdateChunk*); 61 61 void ensureBackingStore(); 62 62 63 void didSetSize(const WebCore::IntSize& viewSize, UpdateChunk &updateChunk);63 void didSetSize(const WebCore::IntSize& viewSize, UpdateChunk* updateChunk); 64 64 65 65 bool m_isInitialized; -
trunk/WebKit2/UIProcess/mac/DrawingAreaProxyUpdateChunk.mm
r57310 r57621 53 53 } 54 54 55 void DrawingAreaProxyUpdateChunk::drawRectIntoContext(CGRect , CGContextRef context)55 void DrawingAreaProxyUpdateChunk::drawRectIntoContext(CGRect rect, CGContextRef context) 56 56 { 57 57 if (!m_isInitialized) { … … 77 77 } 78 78 79 void DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore(UpdateChunk &updateChunk)79 void DrawingAreaProxyUpdateChunk::drawUpdateChunkIntoBackingStore(UpdateChunk* updateChunk) 80 80 { 81 81 ensureBackingStore(); 82 82 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)]; 85 89 } 86 90 … … 92 96 RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); 93 97 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); 94 102 } 95 103 … … 113 121 } 114 122 115 void DrawingAreaProxyUpdateChunk::didSetSize(const IntSize& viewSize, UpdateChunk &updateChunk)123 void DrawingAreaProxyUpdateChunk::didSetSize(const IntSize& viewSize, UpdateChunk* updateChunk) 116 124 { 117 125 ASSERT(m_isWaitingForDidSetFrameNotification); … … 136 144 if (!arguments.decode(updateChunk)) 137 145 return; 138 drawUpdateChunkIntoBackingStore( updateChunk);146 drawUpdateChunkIntoBackingStore(&updateChunk); 139 147 break; 140 148 } … … 145 153 return; 146 154 147 didSetSize(viewSize, updateChunk);155 didSetSize(viewSize, &updateChunk); 148 156 break; 149 157 } -
trunk/WebKit2/WebProcess/WebPage/mac/DrawingAreaUpdateChunk.cpp
r57596 r57621 82 82 RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); 83 83 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 85 89 // Now paint into the backing store. 86 90 GraphicsContext graphicsContext(bitmapContext.get());
Note: See TracChangeset
for help on using the changeset viewer.