| 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 <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "skia/ext/bitmap_platform_device_linux.h" | 12 #include "skia/ext/bitmap_platform_device.h" |
| 13 #include "skia/ext/platform_canvas_linux.h" | 13 #include "skia/ext/platform_canvas.h" |
| 14 #include "skia/ext/platform_device_linux.h" | 14 #include "skia/ext/platform_device.h" |
| 15 #include "webkit/api/public/gtk/WebInputEventFactory.h" | 15 #include "webkit/api/public/gtk/WebInputEventFactory.h" |
| 16 #include "webkit/api/public/x11/WebScreenInfoFactory.h" | 16 #include "webkit/api/public/x11/WebScreenInfoFactory.h" |
| 17 #include "webkit/api/public/WebInputEvent.h" | 17 #include "webkit/api/public/WebInputEvent.h" |
| 18 #include "webkit/api/public/WebScreenInfo.h" | 18 #include "webkit/api/public/WebScreenInfo.h" |
| 19 #include "webkit/api/public/WebSize.h" | 19 #include "webkit/api/public/WebSize.h" |
| 20 #include "webkit/glue/webwidget.h" | 20 #include "webkit/glue/webwidget.h" |
| 21 #include "webkit/tools/test_shell/test_shell.h" | 21 #include "webkit/tools/test_shell/test_shell.h" |
| 22 #include "webkit/tools/test_shell/test_shell_x11.h" | 22 #include "webkit/tools/test_shell/test_shell_x11.h" |
| 23 | 23 |
| 24 using WebKit::WebInputEventFactory; | 24 using WebKit::WebInputEventFactory; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 GdkRectangle grect = { | 350 GdkRectangle grect = { |
| 351 total_paint.x(), | 351 total_paint.x(), |
| 352 total_paint.y(), | 352 total_paint.y(), |
| 353 total_paint.width(), | 353 total_paint.width(), |
| 354 total_paint.height(), | 354 total_paint.height(), |
| 355 }; | 355 }; |
| 356 GdkWindow* window = view_->window; | 356 GdkWindow* window = view_->window; |
| 357 gdk_window_begin_paint_rect(window, &grect); | 357 gdk_window_begin_paint_rect(window, &grect); |
| 358 | 358 |
| 359 // BitBlit to the gdk window. | 359 // BitBlit to the gdk window. |
| 360 skia::PlatformDeviceLinux &platdev = canvas_->getTopPlatformDevice(); | 360 skia::PlatformDevice& platdev = canvas_->getTopPlatformDevice(); |
| 361 skia::BitmapPlatformDeviceLinux* const bitdev = | 361 skia::BitmapPlatformDevice* const bitdev = |
| 362 static_cast<skia::BitmapPlatformDeviceLinux* >(&platdev); | 362 static_cast<skia::BitmapPlatformDevice*>(&platdev); |
| 363 cairo_t* cairo_drawable = gdk_cairo_create(window); | 363 cairo_t* cairo_drawable = gdk_cairo_create(window); |
| 364 cairo_set_source_surface(cairo_drawable, bitdev->surface(), 0, 0); | 364 cairo_set_source_surface(cairo_drawable, bitdev->surface(), 0, 0); |
| 365 cairo_paint(cairo_drawable); | 365 cairo_paint(cairo_drawable); |
| 366 cairo_destroy(cairo_drawable); | 366 cairo_destroy(cairo_drawable); |
| 367 | 367 |
| 368 gdk_window_end_paint(window); | 368 gdk_window_end_paint(window); |
| 369 } | 369 } |
| 370 | 370 |
| 371 WebScreenInfo WebWidgetHost::GetScreenInfo() { | 371 WebScreenInfo WebWidgetHost::GetScreenInfo() { |
| 372 Display* display = test_shell_x11::GtkWidgetGetDisplay(view_); | 372 Display* display = test_shell_x11::GtkWidgetGetDisplay(view_); |
| 373 int screen_num = test_shell_x11::GtkWidgetGetScreenNum(view_); | 373 int screen_num = test_shell_x11::GtkWidgetGetScreenNum(view_); |
| 374 return WebScreenInfoFactory::screenInfo(display, screen_num); | 374 return WebScreenInfoFactory::screenInfo(display, screen_num); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void WebWidgetHost::ResetScrollRect() { | 377 void WebWidgetHost::ResetScrollRect() { |
| 378 // This method is only needed for optimized scroll painting, which we don't | 378 // This method is only needed for optimized scroll painting, which we don't |
| 379 // care about in the test shell, yet. | 379 // care about in the test shell, yet. |
| 380 } | 380 } |
| 381 | 381 |
| 382 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 382 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 383 set_painting(true); | 383 set_painting(true); |
| 384 webwidget_->Paint(canvas_.get(), rect); | 384 webwidget_->Paint(canvas_.get(), rect); |
| 385 set_painting(false); | 385 set_painting(false); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void WebWidgetHost::WindowDestroyed() { | 388 void WebWidgetHost::WindowDestroyed() { |
| 389 delete this; | 389 delete this; |
| 390 } | 390 } |
| OLD | NEW |