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/content_layer.h" | 5 #include "cc/content_layer.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "cc/bitmap_content_layer_updater.h" | 9 #include "cc/bitmap_content_layer_updater.h" |
10 #include "cc/bitmap_skpicture_content_layer_updater.h" | 10 #include "cc/bitmap_skpicture_content_layer_updater.h" |
11 #include "cc/content_layer_client.h" | 11 #include "cc/content_layer_client.h" |
12 #include "cc/layer_painter.h" | 12 #include "cc/layer_painter.h" |
13 #include "cc/layer_tree_host.h" | 13 #include "cc/layer_tree_host.h" |
14 #include "cc/settings.h" | |
15 | 14 |
16 namespace cc { | 15 namespace cc { |
17 | 16 |
18 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client) | 17 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client) |
19 : m_client(client) | 18 : m_client(client) |
20 { | 19 { |
21 } | 20 } |
22 | 21 |
23 scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerClient*
client) | 22 scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerClient*
client) |
24 { | 23 { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return m_updater.get(); | 79 return m_updater.get(); |
81 } | 80 } |
82 | 81 |
83 void ContentLayer::createUpdaterIfNeeded() | 82 void ContentLayer::createUpdaterIfNeeded() |
84 { | 83 { |
85 if (m_updater) | 84 if (m_updater) |
86 return; | 85 return; |
87 scoped_ptr<LayerPainter> painter = ContentLayerPainter::create(m_client).Pas
sAs<LayerPainter>(); | 86 scoped_ptr<LayerPainter> painter = ContentLayerPainter::create(m_client).Pas
sAs<LayerPainter>(); |
88 if (layerTreeHost()->settings().acceleratePainting) | 87 if (layerTreeHost()->settings().acceleratePainting) |
89 m_updater = SkPictureContentLayerUpdater::create(painter.Pass()); | 88 m_updater = SkPictureContentLayerUpdater::create(painter.Pass()); |
90 else if (Settings::perTilePaintingEnabled()) | 89 else if (layerTreeHost()->settings().perTilePaintingEnabled) |
91 m_updater = BitmapSkPictureContentLayerUpdater::create(painter.Pass()); | 90 m_updater = BitmapSkPictureContentLayerUpdater::create(painter.Pass()); |
92 else | 91 else |
93 m_updater = BitmapContentLayerUpdater::create(painter.Pass()); | 92 m_updater = BitmapContentLayerUpdater::create(painter.Pass()); |
94 m_updater->setOpaque(contentsOpaque()); | 93 m_updater->setOpaque(contentsOpaque()); |
95 | 94 |
96 GLenum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFo
rmat; | 95 GLenum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFo
rmat; |
97 setTextureFormat(textureFormat); | 96 setTextureFormat(textureFormat); |
98 } | 97 } |
99 | 98 |
100 void ContentLayer::setContentsOpaque(bool opaque) | 99 void ContentLayer::setContentsOpaque(bool opaque) |
101 { | 100 { |
102 Layer::setContentsOpaque(opaque); | 101 Layer::setContentsOpaque(opaque); |
103 if (m_updater) | 102 if (m_updater) |
104 m_updater->setOpaque(opaque); | 103 m_updater->setOpaque(opaque); |
105 } | 104 } |
106 | 105 |
107 } // namespace cc | 106 } // namespace cc |
OLD | NEW |