Commit 7bb3de43 authored by andersca@apple.com's avatar andersca@apple.com
Browse files

2011-01-18 Anders Carlsson <andersca@apple.com>

        Reviewed by Darin Adler.

        Factor code to create the backing store bitmap context out into a new function
        https://bugs.webkit.org/show_bug.cgi?id=52670

        * UIProcess/BackingStore.h:
        * UIProcess/mac/BackingStoreMac.mm:
        (WebKit::BackingStore::backingStoreContext):
        Create the backing store context.

        (WebKit::BackingStore::incorporateUpdate):
        Call backingStoreContext.

        (WebKit::BackingStore::scroll):
        Assert that the context is not null.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4a699377
2011-01-18 Anders Carlsson <andersca@apple.com>
Reviewed by Darin Adler.
Factor code to create the backing store bitmap context out into a new function
https://bugs.webkit.org/show_bug.cgi?id=52670
* UIProcess/BackingStore.h:
* UIProcess/mac/BackingStoreMac.mm:
(WebKit::BackingStore::backingStoreContext):
Create the backing store context.
(WebKit::BackingStore::incorporateUpdate):
Call backingStoreContext.
(WebKit::BackingStore::scroll):
Assert that the context is not null.
2011-01-18 Anders Carlsson <andersca@apple.com>
 
Reviewed by Dan Bernstein.
......@@ -65,6 +65,8 @@ private:
WebCore::IntSize m_size;
#if PLATFORM(MAC)
CGContextRef backingStoreContext();
RetainPtr<CGContextRef> m_bitmapContext;
#endif
};
......
......@@ -41,14 +41,8 @@ void BackingStore::paint(PlatformGraphicsContext context, const IntRect& rect)
paintBitmapContext(context, m_bitmapContext.get(), rect.location(), rect);
}
void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo)
CGContextRef BackingStore::backingStoreContext()
{
ASSERT(m_size == updateInfo.viewSize);
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.updateRectBounds.size(), updateInfo.bitmapHandle);
if (!bitmap)
return;
if (!m_bitmapContext) {
RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
......@@ -59,11 +53,24 @@ void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo)
CGContextScaleCTM(m_bitmapContext.get(), 1, -1);
}
return m_bitmapContext.get();
}
void BackingStore::incorporateUpdate(const UpdateInfo& updateInfo)
{
ASSERT(m_size == updateInfo.viewSize);
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.updateRectBounds.size(), updateInfo.bitmapHandle);
if (!bitmap)
return;
CGContextRef context = backingStoreContext();
scroll(updateInfo.scrollRect, updateInfo.scrollOffset);
IntPoint updateRectLocation = updateInfo.updateRectBounds.location();
GraphicsContext graphicsContext(m_bitmapContext.get());
GraphicsContext graphicsContext(context);
// Paint all update rects.
for (size_t i = 0; i < updateInfo.updateRects.size(); ++i) {
......@@ -80,6 +87,8 @@ void BackingStore::scroll(const IntRect& scrollRect, const IntSize& scrollOffset
if (scrollOffset.isZero())
return;
ASSERT(m_bitmapContext);
CGContextSaveGState(m_bitmapContext.get());
CGContextClipToRect(m_bitmapContext.get(), scrollRect);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment