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(new skia::PlatformCanvas(width, height, |
| 361 skia::PlatformDevice::FLAGS_OPAQUE | |
| 362 skia::PlatformDevice::FLAGS_INITIALIZED)); |
361 if (!canvas_.get()) { | 363 if (!canvas_.get()) { |
362 // memory allocation failed, we can't paint. | 364 // memory allocation failed, we can't paint. |
363 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; | 365 LOG(ERROR) << "Failed to allocate memory for " << width << "x" << height; |
364 return; | 366 return; |
365 } | 367 } |
366 } | 368 } |
367 | 369 |
368 webwidget_->animate(0.0); | 370 webwidget_->animate(0.0); |
369 | 371 |
370 // This may result in more invalidation | 372 // This may result in more invalidation |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 428 |
427 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { | 429 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { |
428 set_painting(true); | 430 set_painting(true); |
429 webwidget_->paint(canvas_.get(), rect); | 431 webwidget_->paint(canvas_.get(), rect); |
430 set_painting(false); | 432 set_painting(false); |
431 } | 433 } |
432 | 434 |
433 void WebWidgetHost::WindowDestroyed() { | 435 void WebWidgetHost::WindowDestroyed() { |
434 delete this; | 436 delete this; |
435 } | 437 } |
OLD | NEW |