| OLD | NEW |
| 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "webkit/tools/test_shell/webwidget_host.h" | 7 #include "webkit/tools/test_shell/webwidget_host.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 paint_rect_ = client_rect; | 167 paint_rect_ = client_rect; |
| 168 canvas_.reset(new skia::PlatformCanvas( | 168 canvas_.reset(new skia::PlatformCanvas( |
| 169 paint_rect_.width(), paint_rect_.height(), true)); | 169 paint_rect_.width(), paint_rect_.height(), true)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 // make sure webkit draws into our bitmap, not the window | 172 // make sure webkit draws into our bitmap, not the window |
| 173 CGContextRef bitmap_context = | 173 CGContextRef bitmap_context = |
| 174 canvas_->getTopPlatformDevice().GetBitmapContext(); | 174 canvas_->getTopPlatformDevice().GetBitmapContext(); |
| 175 [NSGraphicsContext setCurrentContext: | 175 [NSGraphicsContext setCurrentContext: |
| 176 [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context | 176 [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context |
| 177 flipped:NO]]; | 177 flipped:YES]]; |
| 178 | 178 |
| 179 // This may result in more invalidation | 179 // This may result in more invalidation |
| 180 webwidget_->layout(); | 180 webwidget_->layout(); |
| 181 | 181 |
| 182 // Scroll the canvas if necessary | 182 // Scroll the canvas if necessary |
| 183 scroll_rect_ = client_rect.Intersect(scroll_rect_); | 183 scroll_rect_ = client_rect.Intersect(scroll_rect_); |
| 184 if (!scroll_rect_.IsEmpty()) { | 184 if (!scroll_rect_.IsEmpty()) { |
| 185 // add to invalidate rect, since there's no equivalent of ScrollDC. | 185 // add to invalidate rect, since there's no equivalent of ScrollDC. |
| 186 paint_rect_ = paint_rect_.Union(scroll_rect_); | 186 paint_rect_ = paint_rect_.Union(scroll_rect_); |
| 187 } | 187 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 268 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 269 #ifndef NDEBUG | 269 #ifndef NDEBUG |
| 270 DCHECK(!painting_); | 270 DCHECK(!painting_); |
| 271 #endif | 271 #endif |
| 272 DCHECK(canvas_.get()); | 272 DCHECK(canvas_.get()); |
| 273 | 273 |
| 274 set_painting(true); | 274 set_painting(true); |
| 275 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect); | 275 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect); |
| 276 set_painting(false); | 276 set_painting(false); |
| 277 } | 277 } |
| OLD | NEW |