OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/renderer/render_widget.h" | 5 #include "chrome/renderer/render_widget.h" |
6 | 6 |
7 #include "base/gfx/point.h" | 7 #include "base/gfx/point.h" |
8 #include "base/gfx/size.h" | 8 #include "base/gfx/size.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // Layout may generate more invalidation... | 327 // Layout may generate more invalidation... |
328 webwidget_->Layout(); | 328 webwidget_->Layout(); |
329 | 329 |
330 // OK, save the current paint_rect to a local since painting may cause more | 330 // OK, save the current paint_rect to a local since painting may cause more |
331 // invalidation. Some WebCore rendering objects only layout when painted. | 331 // invalidation. Some WebCore rendering objects only layout when painted. |
332 gfx::Rect damaged_rect = paint_rect_; | 332 gfx::Rect damaged_rect = paint_rect_; |
333 paint_rect_ = gfx::Rect(); | 333 paint_rect_ = gfx::Rect(); |
334 | 334 |
335 // Compute a buffer for painting and cache it. | 335 // Compute a buffer for painting and cache it. |
336 skia::PlatformCanvas* canvas = | 336 skia::PlatformCanvas* canvas = |
337 RenderProcess::current()->GetDrawingCanvas(¤t_paint_buf_, damaged_re
ct); | 337 RenderProcess::current()->GetDrawingCanvas(¤t_paint_buf_, |
| 338 damaged_rect); |
338 if (!canvas) { | 339 if (!canvas) { |
339 NOTREACHED(); | 340 NOTREACHED(); |
340 return; | 341 return; |
341 } | 342 } |
342 | 343 |
343 PaintRect(damaged_rect, canvas); | 344 PaintRect(damaged_rect, canvas); |
344 | 345 |
345 ViewHostMsg_PaintRect_Params params; | 346 ViewHostMsg_PaintRect_Params params; |
346 params.bitmap_rect = damaged_rect; | 347 params.bitmap_rect = damaged_rect; |
347 params.view_size = size_; | 348 params.view_size = size_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } else { | 405 } else { |
405 damaged_rect.set_y(scroll_rect_.bottom() + dy); | 406 damaged_rect.set_y(scroll_rect_.bottom() + dy); |
406 damaged_rect.set_height(-dy); | 407 damaged_rect.set_height(-dy); |
407 } | 408 } |
408 } | 409 } |
409 | 410 |
410 // In case the scroll offset exceeds the width/height of the scroll rect | 411 // In case the scroll offset exceeds the width/height of the scroll rect |
411 damaged_rect = scroll_rect_.Intersect(damaged_rect); | 412 damaged_rect = scroll_rect_.Intersect(damaged_rect); |
412 | 413 |
413 skia::PlatformCanvas* canvas = | 414 skia::PlatformCanvas* canvas = |
414 RenderProcess::current()->GetDrawingCanvas(¤t_scroll_buf_, damaged_r
ect); | 415 RenderProcess::current()->GetDrawingCanvas(¤t_scroll_buf_, |
| 416 damaged_rect); |
415 if (!canvas) { | 417 if (!canvas) { |
416 NOTREACHED(); | 418 NOTREACHED(); |
417 return; | 419 return; |
418 } | 420 } |
419 | 421 |
420 // Set these parameters before calling Paint, since that could result in | 422 // Set these parameters before calling Paint, since that could result in |
421 // further invalidates (uncommon). | 423 // further invalidates (uncommon). |
422 ViewHostMsg_ScrollRect_Params params; | 424 ViewHostMsg_ScrollRect_Params params; |
423 params.bitmap_rect = damaged_rect; | 425 params.bitmap_rect = damaged_rect; |
424 params.dx = scroll_delta_.x(); | 426 params.dx = scroll_delta_.x(); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 for (; i < plugin_window_moves_.size(); ++i) { | 732 for (; i < plugin_window_moves_.size(); ++i) { |
731 if (plugin_window_moves_[i].window == move.window) { | 733 if (plugin_window_moves_[i].window == move.window) { |
732 plugin_window_moves_[i] = move; | 734 plugin_window_moves_[i] = move; |
733 break; | 735 break; |
734 } | 736 } |
735 } | 737 } |
736 | 738 |
737 if (i == plugin_window_moves_.size()) | 739 if (i == plugin_window_moves_.size()) |
738 plugin_window_moves_.push_back(move); | 740 plugin_window_moves_.push_back(move); |
739 } | 741 } |
OLD | NEW |