Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_views.cc

Issue 6261019: Make a hole only as big as is necessary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/render_widget_host_view_views.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void RenderWidgetHostViewViews::SetBackground(const SkBitmap& background) { 348 void RenderWidgetHostViewViews::SetBackground(const SkBitmap& background) {
349 RenderWidgetHostView::SetBackground(background); 349 RenderWidgetHostView::SetBackground(background);
350 host_->Send(new ViewMsg_SetBackground(host_->routing_id(), background)); 350 host_->Send(new ViewMsg_SetBackground(host_->routing_id(), background));
351 } 351 }
352 352
353 void RenderWidgetHostViewViews::Paint(gfx::Canvas* canvas) { 353 void RenderWidgetHostViewViews::Paint(gfx::Canvas* canvas) {
354 if (is_hidden_) { 354 if (is_hidden_) {
355 return; 355 return;
356 } 356 }
357 357
358 // Paint a "hole" in the canvas so that the render of the web page is on
359 // top of whatever else has already been painted in the views hierarchy.
360 // Later views might still get to paint on top.
361 canvas->FillRectInt(SK_ColorBLACK, 0, 0, kMaxWindowWidth, kMaxWindowHeight,
362 SkXfermode::kClear_Mode);
363
364 // Don't do any painting if the GPU process is rendering directly 358 // Don't do any painting if the GPU process is rendering directly
365 // into the View. 359 // into the View.
366 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(); 360 RenderWidgetHost* render_widget_host = GetRenderWidgetHost();
367 if (render_widget_host->is_accelerated_compositing_active()) { 361 if (render_widget_host->is_accelerated_compositing_active()) {
368 return; 362 return;
sadrul 2011/01/21 15:56:53 I do not know if painting the hole is necessary he
Alex Nicolaou 2011/01/21 16:00:16 Yes it is, that's why it was above this point. Oth
369 } 363 }
370 364
371 GdkWindow* window = GetInnerNativeView()->window; 365 GdkWindow* window = GetInnerNativeView()->window;
372 DCHECK(!about_to_validate_and_paint_); 366 DCHECK(!about_to_validate_and_paint_);
373 367
374 // TODO(anicolao): get the damage somehow 368 // TODO(anicolao): get the damage somehow
375 // invalid_rect_ = damage_rect; 369 // invalid_rect_ = damage_rect;
376 invalid_rect_ = bounds(); 370 invalid_rect_ = bounds();
377 gfx::Point origin; 371 gfx::Point origin;
378 ConvertPointToWidget(this, &origin); 372 ConvertPointToWidget(this, &origin);
379 373
380 about_to_validate_and_paint_ = true; 374 about_to_validate_and_paint_ = true;
381 BackingStoreX* backing_store = static_cast<BackingStoreX*>( 375 BackingStoreX* backing_store = static_cast<BackingStoreX*>(
382 host_->GetBackingStore(true)); 376 host_->GetBackingStore(true));
383 // Calling GetBackingStore maybe have changed |invalid_rect_|... 377 // Calling GetBackingStore maybe have changed |invalid_rect_|...
384 about_to_validate_and_paint_ = false; 378 about_to_validate_and_paint_ = false;
385 379
386 gfx::Rect paint_rect = gfx::Rect(0, 0, kMaxWindowWidth, kMaxWindowHeight); 380 gfx::Rect paint_rect = gfx::Rect(0, 0, kMaxWindowWidth, kMaxWindowHeight);
387 paint_rect = paint_rect.Intersect(invalid_rect_); 381 paint_rect = paint_rect.Intersect(invalid_rect_);
382 // Make sure we paint within the bounds.
383 paint_rect = paint_rect.Intersect(bounds());
384
385 // Paint a "hole" in the canvas so that the render of the web page is on
386 // top of whatever else has already been painted in the views hierarchy.
387 // Later views might still get to paint on top.
388 canvas->FillRectInt(SK_ColorBLACK, 0, 0,
389 paint_rect.width(), paint_rect.height(),
390 SkXfermode::kClear_Mode);
Alex Nicolaou 2011/01/21 16:00:16 You'll have to move this back up. If you're reall
sadrul 2011/01/21 16:36:19 Moved this back up.
388 391
389 if (backing_store) { 392 if (backing_store) {
390 // Only render the widget if it is attached to a window; there's a short 393 // Only render the widget if it is attached to a window; there's a short
391 // period where this object isn't attached to a window but hasn't been 394 // period where this object isn't attached to a window but hasn't been
392 // Destroy()ed yet and it receives paint messages... 395 // Destroy()ed yet and it receives paint messages...
393 if (window) { 396 if (window) {
394 if (!visually_deemphasized_) { 397 if (!visually_deemphasized_) {
395 // In the common case, use XCopyArea. We don't draw more than once, so 398 // In the common case, use XCopyArea. We don't draw more than once, so
396 // we don't need to double buffer. 399 // we don't need to double buffer.
397 backing_store->XShowRect(origin, 400 backing_store->XShowRect(origin,
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 769 }
767 770
768 // static 771 // static
769 RenderWidgetHostView* 772 RenderWidgetHostView*
770 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 773 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
771 gfx::NativeView widget) { 774 gfx::NativeView widget) {
772 gpointer user_data = g_object_get_data(G_OBJECT(widget), 775 gpointer user_data = g_object_get_data(G_OBJECT(widget),
773 kRenderWidgetHostViewKey); 776 kRenderWidgetHostViewKey);
774 return reinterpret_cast<RenderWidgetHostView*>(user_data); 777 return reinterpret_cast<RenderWidgetHostView*>(user_data);
775 } 778 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698