| 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/SkDevice.h" | 12 #include "third_party/skia/include/core/SkDevice.h" |
| 13 #include "third_party/skia/include/core/SkPaint.h" | 13 #include "third_party/skia/include/core/SkPaint.h" |
| 14 #include "third_party/skia/include/core/SkRect.h" | 14 #include "third_party/skia/include/core/SkRect.h" |
| 15 #include "third_party/skia/include/core/SkScalar.h" | 15 #include "third_party/skia/include/core/SkScalar.h" |
| 16 #include "ui/gfx/rect_conversions.h" | 16 #include "ui/gfx/rect_conversions.h" |
| 17 #include "ui/gfx/rect_f.h" | 17 #include "ui/gfx/rect_f.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 ContentLayerUpdater::ContentLayerUpdater( | 21 ContentLayerUpdater::ContentLayerUpdater( |
| 22 scoped_ptr<LayerPainter> painter, | 22 scoped_ptr<LayerPainter> painter, |
| 23 RenderingStatsInstrumentation* stats_instrumentation, | 23 RenderingStatsInstrumentation* stats_instrumentation, |
| 24 int layer_id) | 24 int layer_id) |
| 25 : rendering_stats_instrumentation_(stats_instrumentation), | 25 : rendering_stats_instrumentation_(stats_instrumentation), |
| 26 layer_id_(layer_id), | 26 layer_id_(layer_id), |
| 27 painter_(painter.Pass()), | 27 layer_is_opaque_(false), |
| 28 layer_is_opaque_(false) {} | 28 painter_(painter.Pass()) {} |
| 29 | 29 |
| 30 ContentLayerUpdater::~ContentLayerUpdater() {} | 30 ContentLayerUpdater::~ContentLayerUpdater() {} |
| 31 | 31 |
| 32 void ContentLayerUpdater::set_rendering_stats_instrumentation( | 32 void ContentLayerUpdater::set_rendering_stats_instrumentation( |
| 33 RenderingStatsInstrumentation* rsi) { | 33 RenderingStatsInstrumentation* rsi) { |
| 34 rendering_stats_instrumentation_ = rsi; | 34 rendering_stats_instrumentation_ = rsi; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ContentLayerUpdater::PaintContents(SkCanvas* canvas, | 37 void ContentLayerUpdater::PaintContents(SkCanvas* canvas, |
| 38 gfx::Rect content_rect, | 38 gfx::Rect content_rect, |
| 39 gfx::Rect paint_rect, |
| 39 float contents_width_scale, | 40 float contents_width_scale, |
| 40 float contents_height_scale, | 41 float contents_height_scale, |
| 41 gfx::Rect* resulting_opaque_rect) { | 42 gfx::Rect* resulting_opaque_rect) { |
| 42 TRACE_EVENT2("cc", | 43 TRACE_EVENT2("cc", |
| 43 "ContentLayerUpdater::PaintContents", | 44 "ContentLayerUpdater::PaintContents", |
| 44 "width", | 45 "width", |
| 45 content_rect.width(), | 46 content_rect.width(), |
| 46 "height", | 47 "height", |
| 47 content_rect.height()); | 48 content_rect.height()); |
| 48 gfx::Point origin = content_rect.origin(); | 49 gfx::Point origin = content_rect.origin(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 73 | 74 |
| 74 gfx::RectF opaque_layer_rect; | 75 gfx::RectF opaque_layer_rect; |
| 75 painter_->Paint(canvas, layer_rect, &opaque_layer_rect); | 76 painter_->Paint(canvas, layer_rect, &opaque_layer_rect); |
| 76 canvas->restore(); | 77 canvas->restore(); |
| 77 | 78 |
| 78 gfx::Rect opaque_content_rect = gfx::ToEnclosedRect(gfx::ScaleRect( | 79 gfx::Rect opaque_content_rect = gfx::ToEnclosedRect(gfx::ScaleRect( |
| 79 opaque_layer_rect, contents_width_scale, contents_height_scale)); | 80 opaque_layer_rect, contents_width_scale, contents_height_scale)); |
| 80 *resulting_opaque_rect = opaque_content_rect; | 81 *resulting_opaque_rect = opaque_content_rect; |
| 81 | 82 |
| 82 content_rect_ = content_rect; | 83 content_rect_ = content_rect; |
| 84 paint_rect_ = paint_rect; |
| 83 } | 85 } |
| 84 | 86 |
| 85 void ContentLayerUpdater::SetOpaque(bool opaque) { | 87 void ContentLayerUpdater::SetOpaque(bool opaque) { |
| 86 layer_is_opaque_ = opaque; | 88 layer_is_opaque_ = opaque; |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace cc | 91 } // namespace cc |
| OLD | NEW |