OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/content_layer_updater.h" | 5 #include "cc/resources/content_layer_updater.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "cc/debug/rendering_stats_instrumentation.h" | 9 #include "cc/debug/rendering_stats_instrumentation.h" |
10 #include "cc/resources/layer_painter.h" | 10 #include "cc/resources/layer_painter.h" |
11 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
12 #include "third_party/skia/include/core/SkPaint.h" | 12 #include "third_party/skia/include/core/SkPaint.h" |
13 #include "third_party/skia/include/core/SkRect.h" | 13 #include "third_party/skia/include/core/SkRect.h" |
14 #include "third_party/skia/include/core/SkScalar.h" | 14 #include "third_party/skia/include/core/SkScalar.h" |
15 #include "ui/gfx/rect_conversions.h" | 15 #include "ui/gfx/rect_conversions.h" |
16 #include "ui/gfx/rect_f.h" | 16 #include "ui/gfx/rect_f.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 ContentLayerUpdater::ContentLayerUpdater( | 20 ContentLayerUpdater::ContentLayerUpdater( |
21 scoped_ptr<LayerPainter> painter, | 21 scoped_ptr<LayerPainter> painter, |
22 RenderingStatsInstrumentation* stats_instrumentation, | 22 RenderingStatsInstrumentation* stats_instrumentation, |
23 int layer_id) | 23 int layer_id) |
24 : rendering_stats_instrumentation_(stats_instrumentation), | 24 : rendering_stats_instrumentation_(stats_instrumentation), |
25 layer_id_(layer_id), | 25 layer_id_(layer_id), |
26 painter_(painter.Pass()), | 26 layer_is_opaque_(false), |
27 layer_is_opaque_(false) {} | 27 painter_(painter.Pass()) {} |
28 | 28 |
29 ContentLayerUpdater::~ContentLayerUpdater() {} | 29 ContentLayerUpdater::~ContentLayerUpdater() {} |
30 | 30 |
31 void ContentLayerUpdater::set_rendering_stats_instrumentation( | 31 void ContentLayerUpdater::set_rendering_stats_instrumentation( |
32 RenderingStatsInstrumentation* rsi) { | 32 RenderingStatsInstrumentation* rsi) { |
33 rendering_stats_instrumentation_ = rsi; | 33 rendering_stats_instrumentation_ = rsi; |
34 } | 34 } |
35 | 35 |
36 void ContentLayerUpdater::PaintContents(SkCanvas* canvas, | 36 void ContentLayerUpdater::PaintContents(SkCanvas* canvas, |
37 gfx::Point origin, | 37 const gfx::Point& origin, |
38 float contents_width_scale, | 38 float contents_width_scale, |
39 float contents_height_scale, | 39 float contents_height_scale, |
40 gfx::Rect* resulting_opaque_rect) { | 40 gfx::Rect* resulting_opaque_rect) { |
41 TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents"); | 41 TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents"); |
42 canvas->save(); | 42 canvas->save(); |
43 canvas->translate(SkFloatToScalar(-origin.x()), | 43 canvas->translate(SkFloatToScalar(-origin.x()), |
44 SkFloatToScalar(-origin.y())); | 44 SkFloatToScalar(-origin.y())); |
45 | 45 |
46 SkISize size = canvas->getDeviceSize(); | 46 SkISize size = canvas->getDeviceSize(); |
47 gfx::Rect content_rect(origin, gfx::Size(size.width(), size.height())); | 47 gfx::Rect content_rect(origin, gfx::Size(size.width(), size.height())); |
(...skipping 29 matching lines...) Expand all Loading... |
77 *resulting_opaque_rect = opaque_content_rect; | 77 *resulting_opaque_rect = opaque_content_rect; |
78 | 78 |
79 content_rect_ = content_rect; | 79 content_rect_ = content_rect; |
80 } | 80 } |
81 | 81 |
82 void ContentLayerUpdater::SetOpaque(bool opaque) { | 82 void ContentLayerUpdater::SetOpaque(bool opaque) { |
83 layer_is_opaque_ = opaque; | 83 layer_is_opaque_ = opaque; |
84 } | 84 } |
85 | 85 |
86 } // namespace cc | 86 } // namespace cc |
OLD | NEW |