OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 , m_uvRect(0, 0, 1, 1) | 47 , m_uvRect(0, 0, 1, 1) |
48 , m_premultipliedAlpha(true) | 48 , m_premultipliedAlpha(true) |
49 , m_rateLimitContext(false) | 49 , m_rateLimitContext(false) |
50 , m_contextLost(false) | 50 , m_contextLost(false) |
51 , m_textureId(0) | 51 , m_textureId(0) |
52 { | 52 { |
53 } | 53 } |
54 | 54 |
55 TextureLayerChromium::~TextureLayerChromium() | 55 TextureLayerChromium::~TextureLayerChromium() |
56 { | 56 { |
57 if (m_rateLimitContext && m_client && layerTreeHost()) | 57 if (layerTreeHost()) { |
58 layerTreeHost()->stopRateLimiter(m_client->context()); | 58 if (m_textureId) |
| 59 layerTreeHost()->acquireLayerTextures(); |
| 60 if (m_rateLimitContext && m_client) |
| 61 layerTreeHost()->stopRateLimiter(m_client->context()); |
| 62 } |
59 } | 63 } |
60 | 64 |
61 PassOwnPtr<CCLayerImpl> TextureLayerChromium::createCCLayerImpl() | 65 PassOwnPtr<CCLayerImpl> TextureLayerChromium::createCCLayerImpl() |
62 { | 66 { |
63 return CCTextureLayerImpl::create(m_layerId); | 67 return CCTextureLayerImpl::create(m_layerId); |
64 } | 68 } |
65 | 69 |
66 void TextureLayerChromium::setFlipped(bool flipped) | 70 void TextureLayerChromium::setFlipped(bool flipped) |
67 { | 71 { |
68 m_flipped = flipped; | 72 m_flipped = flipped; |
(...skipping 15 matching lines...) Expand all Loading... |
84 void TextureLayerChromium::setRateLimitContext(bool rateLimit) | 88 void TextureLayerChromium::setRateLimitContext(bool rateLimit) |
85 { | 89 { |
86 if (!rateLimit && m_rateLimitContext && m_client && layerTreeHost()) | 90 if (!rateLimit && m_rateLimitContext && m_client && layerTreeHost()) |
87 layerTreeHost()->stopRateLimiter(m_client->context()); | 91 layerTreeHost()->stopRateLimiter(m_client->context()); |
88 | 92 |
89 m_rateLimitContext = rateLimit; | 93 m_rateLimitContext = rateLimit; |
90 } | 94 } |
91 | 95 |
92 void TextureLayerChromium::setTextureId(unsigned id) | 96 void TextureLayerChromium::setTextureId(unsigned id) |
93 { | 97 { |
| 98 if (m_textureId == id) |
| 99 return; |
| 100 if (m_textureId && layerTreeHost()) |
| 101 layerTreeHost()->acquireLayerTextures(); |
94 m_textureId = id; | 102 m_textureId = id; |
95 setNeedsCommit(); | 103 setNeedsCommit(); |
96 } | 104 } |
97 | 105 |
98 void TextureLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) | 106 void TextureLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) |
99 { | 107 { |
100 LayerChromium::setNeedsDisplayRect(dirtyRect); | 108 LayerChromium::setNeedsDisplayRect(dirtyRect); |
101 | 109 |
102 if (m_rateLimitContext && m_client && layerTreeHost()) | 110 if (m_rateLimitContext && m_client && layerTreeHost()) |
103 layerTreeHost()->startRateLimiter(m_client->context()); | 111 layerTreeHost()->startRateLimiter(m_client->context()); |
104 } | 112 } |
105 | 113 |
| 114 void TextureLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) |
| 115 { |
| 116 if (m_textureId && layerTreeHost() && host != layerTreeHost()) |
| 117 layerTreeHost()->acquireLayerTextures(); |
| 118 LayerChromium::setLayerTreeHost(host); |
| 119 } |
| 120 |
106 bool TextureLayerChromium::drawsContent() const | 121 bool TextureLayerChromium::drawsContent() const |
107 { | 122 { |
108 return (m_client || m_textureId) && !m_contextLost && LayerChromium::drawsCo
ntent(); | 123 return (m_client || m_textureId) && !m_contextLost && LayerChromium::drawsCo
ntent(); |
109 } | 124 } |
110 | 125 |
111 void TextureLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTr
acker*) | 126 void TextureLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTr
acker*) |
112 { | 127 { |
113 if (m_client) { | 128 if (m_client) { |
114 m_textureId = m_client->prepareTexture(updater); | 129 m_textureId = m_client->prepareTexture(updater); |
115 m_contextLost = m_client->context()->getExtensions()->getGraphicsResetSt
atusARB() != GraphicsContext3D::NO_ERROR; | 130 m_contextLost = m_client->context()->getExtensions()->getGraphicsResetSt
atusARB() != GraphicsContext3D::NO_ERROR; |
116 } | 131 } |
117 | 132 |
118 m_needsDisplay = false; | 133 m_needsDisplay = false; |
119 } | 134 } |
120 | 135 |
121 void TextureLayerChromium::pushPropertiesTo(CCLayerImpl* layer) | 136 void TextureLayerChromium::pushPropertiesTo(CCLayerImpl* layer) |
122 { | 137 { |
123 LayerChromium::pushPropertiesTo(layer); | 138 LayerChromium::pushPropertiesTo(layer); |
124 | 139 |
125 CCTextureLayerImpl* textureLayer = static_cast<CCTextureLayerImpl*>(layer); | 140 CCTextureLayerImpl* textureLayer = static_cast<CCTextureLayerImpl*>(layer); |
126 textureLayer->setFlipped(m_flipped); | 141 textureLayer->setFlipped(m_flipped); |
127 textureLayer->setUVRect(m_uvRect); | 142 textureLayer->setUVRect(m_uvRect); |
128 textureLayer->setPremultipliedAlpha(m_premultipliedAlpha); | 143 textureLayer->setPremultipliedAlpha(m_premultipliedAlpha); |
129 textureLayer->setTextureId(m_textureId); | 144 textureLayer->setTextureId(m_textureId); |
130 } | 145 } |
131 | 146 |
132 } | 147 } |
133 #endif // USE(ACCELERATED_COMPOSITING) | 148 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |