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 "webkit/tools/test_shell/webwidget_host.h" | 5 #include "webkit/tools/test_shell/webwidget_host.h" |
6 | 6 |
7 #include "base/gfx/rect.h" | 7 #include "base/gfx/rect.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
11 #include "skia/ext/platform_canvas_win.h" | 11 #include "skia/ext/platform_canvas_win.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 void WebWidgetHost::Paint() { | 207 void WebWidgetHost::Paint() { |
208 RECT r; | 208 RECT r; |
209 GetClientRect(view_, &r); | 209 GetClientRect(view_, &r); |
210 gfx::Rect client_rect(r); | 210 gfx::Rect client_rect(r); |
211 | 211 |
212 // Allocate a canvas if necessary | 212 // Allocate a canvas if necessary |
213 if (!canvas_.get()) { | 213 if (!canvas_.get()) { |
214 ResetScrollRect(); | 214 ResetScrollRect(); |
215 paint_rect_ = client_rect; | 215 paint_rect_ = client_rect; |
216 canvas_.reset(new gfx::PlatformCanvas( | 216 canvas_.reset(new skia::PlatformCanvas( |
217 paint_rect_.width(), paint_rect_.height(), true)); | 217 paint_rect_.width(), paint_rect_.height(), true)); |
218 } | 218 } |
219 | 219 |
220 // This may result in more invalidation | 220 // This may result in more invalidation |
221 webwidget_->Layout(); | 221 webwidget_->Layout(); |
222 | 222 |
223 // Scroll the canvas if necessary | 223 // Scroll the canvas if necessary |
224 scroll_rect_ = client_rect.Intersect(scroll_rect_); | 224 scroll_rect_ = client_rect.Intersect(scroll_rect_); |
225 if (!scroll_rect_.IsEmpty()) { | 225 if (!scroll_rect_.IsEmpty()) { |
226 HDC hdc = canvas_->getTopPlatformDevice().getBitmapDC(); | 226 HDC hdc = canvas_->getTopPlatformDevice().getBitmapDC(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 331 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
332 #ifndef NDEBUG | 332 #ifndef NDEBUG |
333 DCHECK(!painting_); | 333 DCHECK(!painting_); |
334 #endif | 334 #endif |
335 DCHECK(canvas_.get()); | 335 DCHECK(canvas_.get()); |
336 | 336 |
337 set_painting(true); | 337 set_painting(true); |
338 webwidget_->Paint(canvas_.get(), rect); | 338 webwidget_->Paint(canvas_.get(), rect); |
339 set_painting(false); | 339 set_painting(false); |
340 } | 340 } |
OLD | NEW |