diff options
author | amanda@chromium.org <amanda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 14:37:57 +0000 |
---|---|---|
committer | amanda@chromium.org <amanda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 14:37:57 +0000 |
commit | 77c327ddb532777dde7e3a6f5dc078d4a76dcfab (patch) | |
tree | 5712e8c775d215c92561e77fb2a999c5f6735a57 /chrome/browser | |
parent | 61e76d9bf46423e8dcb6f77e8e91262af55b7a03 (diff) | |
download | chromium_src-77c327ddb532777dde7e3a6f5dc078d4a76dcfab.zip chromium_src-77c327ddb532777dde7e3a6f5dc078d4a76dcfab.tar.gz chromium_src-77c327ddb532777dde7e3a6f5dc078d4a76dcfab.tar.bz2 |
Change backing store constructor so that it bases the CGLayer on the parent
window's characteristics, and change DidScrollRect to do immediate painting.
BUG=14823
TEST=scrolling should appear slightly smoother on some machines
Review URL: http://codereview.chromium.org/174223
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/renderer_host/backing_store_mac.mm | 14 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_mac.mm | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/renderer_host/backing_store_mac.mm b/chrome/browser/renderer_host/backing_store_mac.mm index e445f7d..8d71b58 100644 --- a/chrome/browser/renderer_host/backing_store_mac.mm +++ b/chrome/browser/renderer_host/backing_store_mac.mm @@ -5,6 +5,8 @@ #import <Cocoa/Cocoa.h> #include "chrome/browser/renderer_host/backing_store.h" +#include "chrome/browser/renderer_host/render_widget_host.h" +#include "chrome/browser/renderer_host/render_widget_host_view.h" #include "base/logging.h" #include "chrome/common/transport_dib.h" @@ -22,9 +24,15 @@ BackingStore::BackingStore(RenderWidgetHost* widget, const gfx::Size& size) : render_widget_host_(widget), size_(size), - cg_layer_(CGLayerCreateWithContext(static_cast<CGContextRef>( - [[NSGraphicsContext currentContext] graphicsPort]), size.ToCGSize(), - NULL)) { + cg_layer_(NULL) { + // We want our CGLayer to be optimized for drawing into our containing + // window, so extract a CGContext corresponding to that window that we can + // pass to CGLayerCreateWithContext. + NSWindow* containing_window = [widget->view()->GetNativeView() window]; + CHECK(containing_window != NULL); + CGContextRef context = static_cast<CGContextRef>([[containing_window graphicsContext] graphicsPort]); + CGLayerRef layer = CGLayerCreateWithContext(context, size.ToCGSize(), NULL); + cg_layer_.reset(layer); CHECK(cg_layer_.get() != NULL); } diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index 18674bb..22bffe5 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -257,7 +257,7 @@ void RenderWidgetHostViewMac::DidScrollRect( // TODO(rohitrao): Evaluate how slow this full redraw is. If it // turns out to be a problem, consider scrolling only a portion of // the view, based on where the findbar and blocked popups are. - [cocoa_view_ setNeedsDisplay:YES]; + DidPaintRect(rect); } void RenderWidgetHostViewMac::RenderViewGone() { |