| 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 "cc/debug/rendering_stats_instrumentation.h" | |
| 9 #include "cc/resources/layer_painter.h" | 8 #include "cc/resources/layer_painter.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 11 #include "third_party/skia/include/core/SkRect.h" | 10 #include "third_party/skia/include/core/SkRect.h" |
| 12 #include "third_party/skia/include/core/SkScalar.h" | 11 #include "third_party/skia/include/core/SkScalar.h" |
| 13 #include "ui/gfx/geometry/rect_conversions.h" | 12 #include "ui/gfx/geometry/rect_conversions.h" |
| 14 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
| 15 #include "ui/gfx/skia_util.h" | 14 #include "ui/gfx/skia_util.h" |
| 16 | 15 |
| 17 namespace cc { | 16 namespace cc { |
| 18 | 17 |
| 19 ContentLayerUpdater::ContentLayerUpdater( | 18 ContentLayerUpdater::ContentLayerUpdater(scoped_ptr<LayerPainter> painter, |
| 20 scoped_ptr<LayerPainter> painter, | 19 int layer_id) |
| 21 RenderingStatsInstrumentation* stats_instrumentation, | 20 : layer_id_(layer_id), |
| 22 int layer_id) | |
| 23 : rendering_stats_instrumentation_(stats_instrumentation), | |
| 24 layer_id_(layer_id), | |
| 25 layer_is_opaque_(false), | 21 layer_is_opaque_(false), |
| 26 layer_fills_bounds_completely_(false), | 22 layer_fills_bounds_completely_(false), |
| 27 painter_(painter.Pass()), | 23 painter_(painter.Pass()), |
| 28 background_color_(SK_ColorTRANSPARENT) { | 24 background_color_(SK_ColorTRANSPARENT) { |
| 29 } | 25 } |
| 30 | 26 |
| 31 ContentLayerUpdater::~ContentLayerUpdater() {} | 27 ContentLayerUpdater::~ContentLayerUpdater() {} |
| 32 | 28 |
| 33 void ContentLayerUpdater::set_rendering_stats_instrumentation( | |
| 34 RenderingStatsInstrumentation* rsi) { | |
| 35 rendering_stats_instrumentation_ = rsi; | |
| 36 } | |
| 37 | |
| 38 void ContentLayerUpdater::PaintContents(SkCanvas* canvas, | 29 void ContentLayerUpdater::PaintContents(SkCanvas* canvas, |
| 39 const gfx::Size& layer_content_size, | 30 const gfx::Size& layer_content_size, |
| 40 const gfx::Rect& paint_rect, | 31 const gfx::Rect& paint_rect, |
| 41 float contents_width_scale, | 32 float contents_width_scale, |
| 42 float contents_height_scale) { | 33 float contents_height_scale) { |
| 43 TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents"); | 34 TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents"); |
| 44 if (!canvas) | 35 if (!canvas) |
| 45 return; | 36 return; |
| 46 canvas->save(); | 37 canvas->save(); |
| 47 canvas->translate(SkIntToScalar(-paint_rect.x()), | 38 canvas->translate(SkIntToScalar(-paint_rect.x()), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 109 |
| 119 void ContentLayerUpdater::SetFillsBoundsCompletely(bool fills_bounds) { | 110 void ContentLayerUpdater::SetFillsBoundsCompletely(bool fills_bounds) { |
| 120 layer_fills_bounds_completely_ = fills_bounds; | 111 layer_fills_bounds_completely_ = fills_bounds; |
| 121 } | 112 } |
| 122 | 113 |
| 123 void ContentLayerUpdater::SetBackgroundColor(SkColor background_color) { | 114 void ContentLayerUpdater::SetBackgroundColor(SkColor background_color) { |
| 124 background_color_ = background_color; | 115 background_color_ = background_color; |
| 125 } | 116 } |
| 126 | 117 |
| 127 } // namespace cc | 118 } // namespace cc |
| OLD | NEW |