| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 paint_rect_.width(), paint_rect_.height(), true)); | 177 paint_rect_.width(), paint_rect_.height(), true)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 // make sure webkit draws into our bitmap, not the window | 180 // make sure webkit draws into our bitmap, not the window |
| 181 CGContextRef bitmap_context = | 181 CGContextRef bitmap_context = |
| 182 skia::GetBitmapContext(skia::GetTopDevice(*canvas_)); | 182 skia::GetBitmapContext(skia::GetTopDevice(*canvas_)); |
| 183 [NSGraphicsContext setCurrentContext: | 183 [NSGraphicsContext setCurrentContext: |
| 184 [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context | 184 [NSGraphicsContext graphicsContextWithGraphicsPort:bitmap_context |
| 185 flipped:YES]]; | 185 flipped:YES]]; |
| 186 | 186 |
| 187 #ifdef WEBWIDGET_HAS_ANIMATE_CHANGES | |
| 188 webwidget_->animate(0.0); | 187 webwidget_->animate(0.0); |
| 189 #else | |
| 190 webwidget_->animate(); | |
| 191 #endif | |
| 192 | 188 |
| 193 // This may result in more invalidation | 189 // This may result in more invalidation |
| 194 webwidget_->layout(); | 190 webwidget_->layout(); |
| 195 | 191 |
| 196 // Scroll the canvas if necessary | 192 // Scroll the canvas if necessary |
| 197 scroll_rect_ = client_rect.Intersect(scroll_rect_); | 193 scroll_rect_ = client_rect.Intersect(scroll_rect_); |
| 198 if (!scroll_rect_.IsEmpty()) { | 194 if (!scroll_rect_.IsEmpty()) { |
| 199 // add to invalidate rect, since there's no equivalent of ScrollDC. | 195 // add to invalidate rect, since there's no equivalent of ScrollDC. |
| 200 paint_rect_ = paint_rect_.Union(scroll_rect_); | 196 paint_rect_ = paint_rect_.Union(scroll_rect_); |
| 201 } | 197 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 277 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 282 #ifndef NDEBUG | 278 #ifndef NDEBUG |
| 283 DCHECK(!painting_); | 279 DCHECK(!painting_); |
| 284 #endif | 280 #endif |
| 285 DCHECK(canvas_.get()); | 281 DCHECK(canvas_.get()); |
| 286 | 282 |
| 287 set_painting(true); | 283 set_painting(true); |
| 288 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect); | 284 webwidget_->paint(webkit_glue::ToWebCanvas(canvas_.get()), rect); |
| 289 set_painting(false); | 285 set_painting(false); |
| 290 } | 286 } |
| OLD | NEW |