| 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" |
| (...skipping 339 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::PlatformDevice& platdev = canvas_->getTopPlatformDevice(); | 360 cairo_t* source_surface = canvas_->beginPlatformPaint(); |
| 361 skia::BitmapPlatformDevice* const bitdev = | |
| 362 static_cast<skia::BitmapPlatformDevice*>(&platdev); | |
| 363 cairo_t* cairo_drawable = gdk_cairo_create(window); | 361 cairo_t* cairo_drawable = gdk_cairo_create(window); |
| 364 cairo_set_source_surface(cairo_drawable, bitdev->surface(), 0, 0); | 362 cairo_set_source_surface(cairo_drawable, cairo_get_target(source_surface), |
| 363 0, 0); |
| 365 cairo_paint(cairo_drawable); | 364 cairo_paint(cairo_drawable); |
| 366 cairo_destroy(cairo_drawable); | 365 cairo_destroy(cairo_drawable); |
| 367 | 366 |
| 368 gdk_window_end_paint(window); | 367 gdk_window_end_paint(window); |
| 369 } | 368 } |
| 370 | 369 |
| 371 WebScreenInfo WebWidgetHost::GetScreenInfo() { | 370 WebScreenInfo WebWidgetHost::GetScreenInfo() { |
| 372 Display* display = test_shell_x11::GtkWidgetGetDisplay(view_); | 371 Display* display = test_shell_x11::GtkWidgetGetDisplay(view_); |
| 373 int screen_num = test_shell_x11::GtkWidgetGetScreenNum(view_); | 372 int screen_num = test_shell_x11::GtkWidgetGetScreenNum(view_); |
| 374 return WebScreenInfoFactory::screenInfo(display, screen_num); | 373 return WebScreenInfoFactory::screenInfo(display, screen_num); |
| 375 } | 374 } |
| 376 | 375 |
| 377 void WebWidgetHost::ResetScrollRect() { | 376 void WebWidgetHost::ResetScrollRect() { |
| 378 // This method is only needed for optimized scroll painting, which we don't | 377 // This method is only needed for optimized scroll painting, which we don't |
| 379 // care about in the test shell, yet. | 378 // care about in the test shell, yet. |
| 380 } | 379 } |
| 381 | 380 |
| 382 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 381 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 383 set_painting(true); | 382 set_painting(true); |
| 384 webwidget_->paint(canvas_.get(), rect); | 383 webwidget_->paint(canvas_.get(), rect); |
| 385 set_painting(false); | 384 set_painting(false); |
| 386 } | 385 } |
| 387 | 386 |
| 388 void WebWidgetHost::WindowDestroyed() { | 387 void WebWidgetHost::WindowDestroyed() { |
| 389 delete this; | 388 delete this; |
| 390 } | 389 } |
| OLD | NEW |