| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/content_layer.h" | 5 #include "cc/layers/content_layer.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
| 11 #include "cc/resources/bitmap_content_layer_updater.h" | 11 #include "cc/resources/bitmap_content_layer_updater.h" |
| 12 #include "cc/resources/bitmap_skpicture_content_layer_updater.h" | 12 #include "cc/resources/bitmap_skpicture_content_layer_updater.h" |
| 13 #include "cc/resources/layer_painter.h" | 13 #include "cc/resources/layer_painter.h" |
| 14 #include "cc/trees/layer_tree_host.h" | 14 #include "cc/trees/layer_tree_host.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client) | 18 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client) |
| 19 : client_(client) {} | 19 : client_(client) {} |
| 20 | 20 |
| 21 scoped_ptr<ContentLayerPainter> ContentLayerPainter::Create( | 21 scoped_ptr<ContentLayerPainter> ContentLayerPainter::Create( |
| 22 ContentLayerClient* client) { | 22 ContentLayerClient* client) { |
| 23 return make_scoped_ptr(new ContentLayerPainter(client)); | 23 return make_scoped_ptr(new ContentLayerPainter(client)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void ContentLayerPainter::Paint(SkCanvas* canvas, | 26 void ContentLayerPainter::Paint(SkCanvas* canvas, |
| 27 gfx::Rect content_rect, | 27 const gfx::Rect& content_rect, |
| 28 gfx::RectF* opaque) { | 28 gfx::RectF* opaque) { |
| 29 base::TimeTicks paint_start = base::TimeTicks::HighResNow(); | 29 base::TimeTicks paint_start = base::TimeTicks::HighResNow(); |
| 30 client_->PaintContents(canvas, content_rect, opaque); | 30 client_->PaintContents(canvas, content_rect, opaque); |
| 31 base::TimeTicks paint_end = base::TimeTicks::HighResNow(); | 31 base::TimeTicks paint_end = base::TimeTicks::HighResNow(); |
| 32 // The start and end times might be the same if the paint was very fast or if | 32 // The start and end times might be the same if the paint was very fast or if |
| 33 // our timer granularity is poor. Treat this as a very short time duration | 33 // our timer granularity is poor. Treat this as a very short time duration |
| 34 // instead of none to avoid dividing by zero. | 34 // instead of none to avoid dividing by zero. |
| 35 if (paint_end == paint_start) | 35 if (paint_end == paint_start) |
| 36 paint_end += base::TimeDelta::FromMicroseconds(1); | 36 paint_end += base::TimeDelta::FromMicroseconds(1); |
| 37 | 37 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 return picture; | 165 return picture; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void ContentLayer::OnOutputSurfaceCreated() { | 168 void ContentLayer::OnOutputSurfaceCreated() { |
| 169 SetTextureFormat( | 169 SetTextureFormat( |
| 170 layer_tree_host()->GetRendererCapabilities().best_texture_format); | 170 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
| 171 TiledLayer::OnOutputSurfaceCreated(); | 171 TiledLayer::OnOutputSurfaceCreated(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace cc | 174 } // namespace cc |
| OLD | NEW |