Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: webkit/tools/test_shell/mac/webwidget_host.mm

Issue 43058: Reverting 11396. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.cc ('k') | webkit/tools/test_shell/test_shell.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/mac/webwidget_host.mm
===================================================================
--- webkit/tools/test_shell/mac/webwidget_host.mm (revision 11408)
+++ webkit/tools/test_shell/mac/webwidget_host.mm (working copy)
@@ -143,14 +143,10 @@
}
void WebWidgetHost::Paint() {
- PaintToCanvas();
- PaintCanvasToView();
-}
-
-void WebWidgetHost::PaintToCanvas() {
NSRect r = [view_ frame];
gfx::Rect client_rect(NSRectToCGRect(r));
NSGraphicsContext* view_context = [NSGraphicsContext currentContext];
+ CGContextRef context = static_cast<CGContextRef>([view_context graphicsPort]);
// Allocate a canvas if necessary
if (!canvas_.get()) {
@@ -195,45 +191,21 @@
// set the context back to our window
[NSGraphicsContext setCurrentContext: view_context];
-}
-void WebWidgetHost::PaintCanvasToView() {
// Paint to the screen
if ([view_ lockFocusIfCanDraw]) {
- NSGraphicsContext* view_context = [NSGraphicsContext currentContext];
- NSRect r = [view_ frame];
- CGContextRef bitmap_context =
- canvas_->getTopPlatformDevice().GetBitmapContext();
- CGContextRef context =
- static_cast<CGContextRef>([view_context graphicsPort]);
CGRect paint_rect = NSRectToCGRect(r);
int bitmap_height = CGBitmapContextGetHeight(bitmap_context);
int bitmap_width = CGBitmapContextGetWidth(bitmap_context);
CGRect bitmap_rect = { { 0, 0 },
{ bitmap_width, bitmap_height } };
canvas_->getTopPlatformDevice().DrawToContext(
- context, 0, r.size.height - bitmap_height, &bitmap_rect);
+ context, 0, client_rect.height() - bitmap_height, &bitmap_rect);
[view_ unlockFocus];
}
}
-void WebWidgetHost::DisplayForRepaint() {
- PaintToCanvas();
-
- // Paint a gray mask over everything for the repaint Layout tests.
- CGContextRef bitmap_context =
- canvas_->getTopPlatformDevice().GetBitmapContext();
- CGRect bitmap_rect = { { 0, 0 },
- { CGBitmapContextGetWidth(bitmap_context),
- CGBitmapContextGetHeight(bitmap_context) } };
- CGContextSetBlendMode(bitmap_context, kCGBlendModeNormal);
- CGContextSetRGBFillColor(bitmap_context, 0, 0, 0, 0.66);
- CGContextFillRect(bitmap_context, bitmap_rect);
-
- PaintCanvasToView();
-}
-
void WebWidgetHost::Resize(const gfx::Rect& rect) {
// Force an entire re-paint. TODO(darin): Maybe reuse this memory buffer.
DiscardBackingStore();
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.cc ('k') | webkit/tools/test_shell/test_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698