| 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 #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 | 350 |
| 351 void WebWidgetHost::Paint() { | 351 void WebWidgetHost::Paint() { |
| 352 int width = logical_size_.width(); | 352 int width = logical_size_.width(); |
| 353 int height = logical_size_.height(); | 353 int height = logical_size_.height(); |
| 354 gfx::Rect client_rect(width, height); | 354 gfx::Rect client_rect(width, height); |
| 355 | 355 |
| 356 // Allocate a canvas if necessary | 356 // Allocate a canvas if necessary |
| 357 if (!canvas_.get()) { | 357 if (!canvas_.get()) { |
| 358 ResetScrollRect(); | 358 ResetScrollRect(); |
| 359 paint_rect_ = client_rect; | 359 paint_rect_ = client_rect; |
| 360 canvas_.reset(new skia::PlatformCanvas(width, height, true)); | 360 canvas_.reset(skia::CreatePlatformCanvas(width, height, true, 0, |
| 361 skia::RETURN_NULL_ON_FAILURE)); |
| 361 if (!canvas_.get()) { | 362 if (!canvas_.get()) { |
| 362 // memory allocation failed, we can't paint. | 363 // memory allocation failed, we can't paint. |
| 363 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; | 364 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; |
| 364 return; | 365 return; |
| 365 } | 366 } |
| 366 } | 367 } |
| 367 | 368 |
| 368 webwidget_->animate(0.0); | 369 webwidget_->animate(0.0); |
| 369 | 370 |
| 370 // This may result in more invalidation | 371 // This may result in more invalidation |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 427 |
| 427 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 428 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
| 428 set_painting(true); | 429 set_painting(true); |
| 429 webwidget_->paint(canvas_.get(), rect); | 430 webwidget_->paint(canvas_.get(), rect); |
| 430 set_painting(false); | 431 set_painting(false); |
| 431 } | 432 } |
| 432 | 433 |
| 433 void WebWidgetHost::WindowDestroyed() { | 434 void WebWidgetHost::WindowDestroyed() { |
| 434 delete this; | 435 delete this; |
| 435 } | 436 } |
| OLD | NEW |