OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 rasterize_begin_ticks = base::TimeTicks::HighResNow(); | 667 rasterize_begin_ticks = base::TimeTicks::HighResNow(); |
668 canvas->save(); | 668 canvas->save(); |
669 | 669 |
670 // Bring the canvas into the coordinate system of the paint rect. | 670 // Bring the canvas into the coordinate system of the paint rect. |
671 canvas->translate(static_cast<SkScalar>(-canvas_origin.x()), | 671 canvas->translate(static_cast<SkScalar>(-canvas_origin.x()), |
672 static_cast<SkScalar>(-canvas_origin.y())); | 672 static_cast<SkScalar>(-canvas_origin.y())); |
673 | 673 |
674 // If there is a custom background, tile it. | 674 // If there is a custom background, tile it. |
675 if (!background_.empty()) { | 675 if (!background_.empty()) { |
676 SkPaint paint; | 676 SkPaint paint; |
677 SkShader* shader = SkShader::CreateBitmapShader(background_, | 677 skia::RefPtr<SkShader> shader = SkShader::CreateBitmapShader( |
678 SkShader::kRepeat_TileMode, | 678 background_, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); |
679 SkShader::kRepeat_TileMode); | 679 paint.setShader(shader.get()); |
680 paint.setShader(shader)->unref(); | |
681 | 680 |
682 // Use kSrc_Mode to handle background_ transparency properly. | 681 // Use kSrc_Mode to handle background_ transparency properly. |
683 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 682 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
684 | 683 |
685 // Canvas could contain multiple update rects. Clip to given rect so that | 684 // Canvas could contain multiple update rects. Clip to given rect so that |
686 // we don't accidentally clear other update rects. | 685 // we don't accidentally clear other update rects. |
687 canvas->save(); | 686 canvas->save(); |
688 canvas->clipRect(gfx::RectToSkRect(rect)); | 687 canvas->clipRect(gfx::RectToSkRect(rect)); |
689 canvas->drawPaint(paint); | 688 canvas->drawPaint(paint); |
690 canvas->restore(); | 689 canvas->restore(); |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 bool RenderWidget::WillHandleGestureEvent( | 1961 bool RenderWidget::WillHandleGestureEvent( |
1963 const WebKit::WebGestureEvent& event) { | 1962 const WebKit::WebGestureEvent& event) { |
1964 return false; | 1963 return false; |
1965 } | 1964 } |
1966 | 1965 |
1967 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1966 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1968 return false; | 1967 return false; |
1969 } | 1968 } |
1970 | 1969 |
1971 } // namespace content | 1970 } // namespace content |
OLD | NEW |