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