| 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 "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 canvas->translate(static_cast<SkScalar>(-canvas_origin.x()), | 527 canvas->translate(static_cast<SkScalar>(-canvas_origin.x()), |
| 528 static_cast<SkScalar>(-canvas_origin.y())); | 528 static_cast<SkScalar>(-canvas_origin.y())); |
| 529 | 529 |
| 530 // If there is a custom background, tile it. | 530 // If there is a custom background, tile it. |
| 531 if (!background_.empty()) { | 531 if (!background_.empty()) { |
| 532 SkPaint paint; | 532 SkPaint paint; |
| 533 SkShader* shader = SkShader::CreateBitmapShader(background_, | 533 SkShader* shader = SkShader::CreateBitmapShader(background_, |
| 534 SkShader::kRepeat_TileMode, | 534 SkShader::kRepeat_TileMode, |
| 535 SkShader::kRepeat_TileMode); | 535 SkShader::kRepeat_TileMode); |
| 536 paint.setShader(shader)->unref(); | 536 paint.setShader(shader)->unref(); |
| 537 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 537 |
| 538 // Use kSrc_Mode to handle background_ transparency properly. |
| 539 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 540 |
| 541 // Canvas could contain multiple update rects. Clip to given rect so that |
| 542 // we don't accidentally clear other update rects. |
| 543 canvas->save(); |
| 544 SkRect clip; |
| 545 clip.set(SkIntToScalar(rect.x()), SkIntToScalar(rect.y()), |
| 546 SkIntToScalar(rect.right()), SkIntToScalar(rect.bottom())); |
| 547 canvas->clipRect(clip); |
| 538 canvas->drawPaint(paint); | 548 canvas->drawPaint(paint); |
| 549 canvas->restore(); |
| 539 } | 550 } |
| 540 | 551 |
| 541 // First see if this rect is a plugin that can paint itself faster. | 552 // First see if this rect is a plugin that can paint itself faster. |
| 542 TransportDIB* optimized_dib = NULL; | 553 TransportDIB* optimized_dib = NULL; |
| 543 gfx::Rect optimized_copy_rect, optimized_copy_location; | 554 gfx::Rect optimized_copy_rect, optimized_copy_location; |
| 544 webkit::ppapi::PluginInstance* optimized_instance = | 555 webkit::ppapi::PluginInstance* optimized_instance = |
| 545 GetBitmapForOptimizedPluginPaint(rect, &optimized_dib, | 556 GetBitmapForOptimizedPluginPaint(rect, &optimized_dib, |
| 546 &optimized_copy_location, | 557 &optimized_copy_location, |
| 547 &optimized_copy_rect); | 558 &optimized_copy_rect); |
| 548 if (optimized_instance) { | 559 if (optimized_instance) { |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 } | 1439 } |
| 1429 } | 1440 } |
| 1430 | 1441 |
| 1431 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1442 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 1432 return false; | 1443 return false; |
| 1433 } | 1444 } |
| 1434 | 1445 |
| 1435 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1446 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
| 1436 return false; | 1447 return false; |
| 1437 } | 1448 } |
| OLD | NEW |