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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/image_layer.h" | 7 #include "cc/image_layer.h" |
8 | 8 |
9 #include "CCLayerTreeHost.h" | 9 #include "CCLayerTreeHost.h" |
10 #include "CCTextureUpdateQueue.h" | 10 #include "CCTextureUpdateQueue.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 { | 39 { |
40 return make_scoped_refptr(new ImageLayerTextureUpdater()); | 40 return make_scoped_refptr(new ImageLayerTextureUpdater()); |
41 } | 41 } |
42 | 42 |
43 virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture( | 43 virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture( |
44 CCPrioritizedTextureManager* manager) OVERRIDE | 44 CCPrioritizedTextureManager* manager) OVERRIDE |
45 { | 45 { |
46 return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrio
ritizedTexture::create(manager))); | 46 return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrio
ritizedTexture::create(manager))); |
47 } | 47 } |
48 | 48 |
49 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRI
DE | 49 virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE |
50 { | 50 { |
51 return PlatformColor::sameComponentOrder(textureFormat) ? | 51 return PlatformColor::sameComponentOrder(textureFormat) ? |
52 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdate
r::SampledTexelFormatBGRA; | 52 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdate
r::SampledTexelFormatBGRA; |
53 } | 53 } |
54 | 54 |
55 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) | 55 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) |
56 { | 56 { |
57 // Source rect should never go outside the image pixels, even if this | 57 // Source rect should never go outside the image pixels, even if this |
58 // is requested because the texture extends outside the image. | 58 // is requested because the texture extends outside the image. |
59 IntRect clippedSourceRect = sourceRect; | 59 IntRect clippedSourceRect = sourceRect; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 TiledLayerChromium::update(queue, occlusion, stats); | 132 TiledLayerChromium::update(queue, occlusion, stats); |
133 } | 133 } |
134 | 134 |
135 void ImageLayerChromium::createTextureUpdaterIfNeeded() | 135 void ImageLayerChromium::createTextureUpdaterIfNeeded() |
136 { | 136 { |
137 if (m_textureUpdater) | 137 if (m_textureUpdater) |
138 return; | 138 return; |
139 | 139 |
140 m_textureUpdater = ImageLayerTextureUpdater::create(); | 140 m_textureUpdater = ImageLayerTextureUpdater::create(); |
141 GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTexture
Format; | 141 GLenum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFo
rmat; |
142 setTextureFormat(textureFormat); | 142 setTextureFormat(textureFormat); |
143 setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); | 143 setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); |
144 } | 144 } |
145 | 145 |
146 LayerTextureUpdater* ImageLayerChromium::textureUpdater() const | 146 LayerTextureUpdater* ImageLayerChromium::textureUpdater() const |
147 { | 147 { |
148 return m_textureUpdater.get(); | 148 return m_textureUpdater.get(); |
149 } | 149 } |
150 | 150 |
151 IntSize ImageLayerChromium::contentBounds() const | 151 IntSize ImageLayerChromium::contentBounds() const |
152 { | 152 { |
153 return IntSize(m_bitmap.width(), m_bitmap.height()); | 153 return IntSize(m_bitmap.width(), m_bitmap.height()); |
154 } | 154 } |
155 | 155 |
156 bool ImageLayerChromium::drawsContent() const | 156 bool ImageLayerChromium::drawsContent() const |
157 { | 157 { |
158 return !m_bitmap.isNull() && TiledLayerChromium::drawsContent(); | 158 return !m_bitmap.isNull() && TiledLayerChromium::drawsContent(); |
159 } | 159 } |
160 | 160 |
161 bool ImageLayerChromium::needsContentsScale() const | 161 bool ImageLayerChromium::needsContentsScale() const |
162 { | 162 { |
163 // Contents scale is not need for image layer because this can be done in co
mpositor more efficiently. | 163 // Contents scale is not need for image layer because this can be done in co
mpositor more efficiently. |
164 return false; | 164 return false; |
165 } | 165 } |
166 | 166 |
167 } | 167 } |
OLD | NEW |