OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 PassOwnPtr<CCLayerTreeHostImpl> CCLayerTreeHostImpl::create(const CCSettings& se
ttings) | 41 PassOwnPtr<CCLayerTreeHostImpl> CCLayerTreeHostImpl::create(const CCSettings& se
ttings) |
42 { | 42 { |
43 return adoptPtr(new CCLayerTreeHostImpl(settings)); | 43 return adoptPtr(new CCLayerTreeHostImpl(settings)); |
44 } | 44 } |
45 | 45 |
46 CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCSettings& settings) | 46 CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCSettings& settings) |
47 : m_sourceFrameNumber(-1) | 47 : m_sourceFrameNumber(-1) |
48 , m_frameNumber(0) | 48 , m_frameNumber(0) |
49 , m_settings(settings) | 49 , m_settings(settings) |
| 50 , m_visible(true) |
50 { | 51 { |
51 ASSERT(CCProxy::isImplThread()); | 52 ASSERT(CCProxy::isImplThread()); |
52 } | 53 } |
53 | 54 |
54 CCLayerTreeHostImpl::~CCLayerTreeHostImpl() | 55 CCLayerTreeHostImpl::~CCLayerTreeHostImpl() |
55 { | 56 { |
56 ASSERT(CCProxy::isImplThread()); | 57 ASSERT(CCProxy::isImplThread()); |
57 TRACE_EVENT("CCLayerTreeHostImpl::~CCLayerTreeHostImpl()", this, 0); | 58 TRACE_EVENT("CCLayerTreeHostImpl::~CCLayerTreeHostImpl()", this, 0); |
58 if (m_layerRenderer) | 59 if (m_layerRenderer) |
59 m_layerRenderer->close(); | 60 m_layerRenderer->close(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 m_layerRenderer->getFramebufferPixels(pixels, rect); | 116 m_layerRenderer->getFramebufferPixels(pixels, rect); |
116 } | 117 } |
117 | 118 |
118 void CCLayerTreeHostImpl::setRootLayer(PassRefPtr<CCLayerImpl> layer) | 119 void CCLayerTreeHostImpl::setRootLayer(PassRefPtr<CCLayerImpl> layer) |
119 { | 120 { |
120 m_rootLayerImpl = layer; | 121 m_rootLayerImpl = layer; |
121 } | 122 } |
122 | 123 |
123 void CCLayerTreeHostImpl::setVisible(bool visible) | 124 void CCLayerTreeHostImpl::setVisible(bool visible) |
124 { | 125 { |
| 126 if (m_visible == visible) |
| 127 return; |
| 128 m_visible = visible; |
| 129 |
125 if (m_layerRenderer) | 130 if (m_layerRenderer) |
126 m_layerRenderer->setVisible(visible); | 131 m_layerRenderer->setVisible(visible); |
127 } | 132 } |
128 | 133 |
129 bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<GraphicsContext3D>
context) | 134 bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<GraphicsContext3D>
context) |
130 { | 135 { |
131 OwnPtr<LayerRendererChromium> layerRenderer; | 136 OwnPtr<LayerRendererChromium> layerRenderer; |
132 layerRenderer = LayerRendererChromium::create(this, context); | 137 layerRenderer = LayerRendererChromium::create(this, context); |
133 | 138 |
134 // If creation failed, and we had asked for accelerated painting, disable ac
celerated painting | 139 // If creation failed, and we had asked for accelerated painting, disable ac
celerated painting |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 info.scrollDelta = rootLayer()->scrollDelta(); | 183 info.scrollDelta = rootLayer()->scrollDelta(); |
179 scrollInfo->append(info); | 184 scrollInfo->append(info); |
180 | 185 |
181 rootLayer()->setScrollPosition(rootLayer()->scrollPosition() + rootLayer
()->scrollDelta()); | 186 rootLayer()->setScrollPosition(rootLayer()->scrollPosition() + rootLayer
()->scrollDelta()); |
182 rootLayer()->setScrollDelta(IntSize()); | 187 rootLayer()->setScrollDelta(IntSize()); |
183 } | 188 } |
184 return scrollInfo.release(); | 189 return scrollInfo.release(); |
185 } | 190 } |
186 | 191 |
187 } | 192 } |
OLD | NEW |