OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/prioritized_texture.h" | 7 #include "cc/prioritized_texture.h" |
8 | 8 |
9 #include "cc/platform_color.h" | 9 #include "cc/platform_color.h" |
10 #include "cc/prioritized_texture_manager.h" | 10 #include "cc/prioritized_texture_manager.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 m_manager->acquireBackingTextureIfNeeded(this, resourceProvider); | 83 m_manager->acquireBackingTextureIfNeeded(this, resourceProvider); |
84 } | 84 } |
85 | 85 |
86 ResourceProvider::ResourceId PrioritizedTexture::resourceId() const | 86 ResourceProvider::ResourceId PrioritizedTexture::resourceId() const |
87 { | 87 { |
88 if (m_backing) | 88 if (m_backing) |
89 return m_backing->id(); | 89 return m_backing->id(); |
90 return 0; | 90 return 0; |
91 } | 91 } |
92 | 92 |
93 void PrioritizedTexture::upload(ResourceProvider* resourceProvider, | 93 void PrioritizedTexture::setPixels(ResourceProvider* resourceProvider, |
94 const uint8_t* image, const gfx::Rect& imageRect
, | 94 const uint8_t* image, const gfx::Rect& imageR
ect, |
95 const gfx::Rect& sourceRect, const gfx::Vector2d
& destOffset) | 95 const gfx::Rect& sourceRect, const gfx::Vecto
r2d& destOffset) |
96 { | 96 { |
97 DCHECK(m_isAbovePriorityCutoff); | 97 DCHECK(m_isAbovePriorityCutoff); |
98 if (m_isAbovePriorityCutoff) | 98 if (m_isAbovePriorityCutoff) |
99 acquireBackingTexture(resourceProvider); | 99 acquireBackingTexture(resourceProvider); |
100 DCHECK(m_backing); | 100 DCHECK(m_backing); |
101 resourceProvider->upload(resourceId(), image, imageRect, sourceRect, destOff
set); | 101 resourceProvider->setPixels(resourceId(), image, imageRect, sourceRect, dest
Offset); |
102 | 102 |
103 // The component order may be bgra if we uploaded bgra pixels to rgba | 103 // The component order may be bgra if we uploaded bgra pixels to rgba |
104 // texture. Mark contents as swizzled if image component order is | 104 // texture. Mark contents as swizzled if image component order is |
105 // different than texture format. | 105 // different than texture format. |
106 m_contentsSwizzled = !PlatformColor::sameComponentOrder(m_format); | 106 m_contentsSwizzled = !PlatformColor::sameComponentOrder(m_format); |
107 } | 107 } |
108 | 108 |
109 void PrioritizedTexture::link(Backing* backing) | 109 void PrioritizedTexture::link(Backing* backing) |
110 { | 110 { |
111 DCHECK(backing); | 111 DCHECK(backing); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 197 } |
198 | 198 |
199 void PrioritizedTexture::returnBackingTexture() | 199 void PrioritizedTexture::returnBackingTexture() |
200 { | 200 { |
201 DCHECK(m_manager || !m_backing); | 201 DCHECK(m_manager || !m_backing); |
202 if (m_manager) | 202 if (m_manager) |
203 m_manager->returnBackingTexture(this); | 203 m_manager->returnBackingTexture(this); |
204 } | 204 } |
205 | 205 |
206 } // namespace cc | 206 } // namespace cc |
OLD | NEW |