OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/render_surface_impl.h" | 5 #include "cc/render_surface_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 | 202 |
203 gfx::RectF maskUVRect(0.0f, 0.0f, 1.0f, 1.0f); | 203 gfx::RectF maskUVRect(0.0f, 0.0f, 1.0f, 1.0f); |
204 if (maskLayer) { | 204 if (maskLayer) { |
205 gfx::Vector2dF owningLayerDrawScale = MathUtil::computeTransform2dScaleC omponents(m_owningLayer->drawTransform(), 1.f); | 205 gfx::Vector2dF owningLayerDrawScale = MathUtil::computeTransform2dScaleC omponents(m_owningLayer->drawTransform(), 1.f); |
206 gfx::SizeF unclippedSurfaceSize = gfx::ScaleSize( | 206 gfx::SizeF unclippedSurfaceSize = gfx::ScaleSize( |
207 m_owningLayer->contentBounds(), | 207 m_owningLayer->contentBounds(), |
208 owningLayerDrawScale.x(), | 208 owningLayerDrawScale.x(), |
209 owningLayerDrawScale.y()); | 209 owningLayerDrawScale.y()); |
210 // This assumes that the owning layer clips its subtree when a mask is | 210 // This assumes that the owning layer clips its subtree when a mask is |
211 // present. | 211 // present. |
212 DCHECK(gfx::RectF(unclippedSurfaceSize).Contains(contentRect())); | 212 DCHECK(gfx::RectF(unclippedSurfaceSize).Contains( |
213 gfx::Rect(contentRect().size()))); | |
shawnsingh
2013/02/04 21:51:08
Thanks for catching this. I think it might be a s
danakj
2013/02/04 21:52:15
I just didn't think we have the position of the un
shawnsingh
2013/02/04 21:59:24
Oh, I see, you're right.
Also, thinking a second
| |
213 | 214 |
214 float uvScaleX = contentRect().width() / unclippedSurfaceSize.width(); | 215 float uvScaleX = contentRect().width() / unclippedSurfaceSize.width(); |
215 float uvScaleY = contentRect().height() / unclippedSurfaceSize.height(); | 216 float uvScaleY = contentRect().height() / unclippedSurfaceSize.height(); |
216 | 217 |
217 maskUVRect = gfx::RectF( | 218 maskUVRect = gfx::RectF( |
218 static_cast<float>(contentRect().x()) / contentRect().width() * uvSc aleX, | 219 static_cast<float>(contentRect().x()) / contentRect().width() * uvSc aleX, |
219 static_cast<float>(contentRect().y()) / contentRect().height() * uvS caleY, | 220 static_cast<float>(contentRect().y()) / contentRect().height() * uvS caleY, |
220 uvScaleX, | 221 uvScaleX, |
221 uvScaleY); | 222 uvScaleY); |
222 } | 223 } |
223 | 224 |
224 ResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->content sResourceId() : 0; | 225 ResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->content sResourceId() : 0; |
225 gfx::Rect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : gfx::Rect(); | 226 gfx::Rect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : gfx::Rect(); |
226 | 227 |
227 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); | 228 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); |
228 quad->SetNew(sharedQuadState, contentRect(), renderPassId, forReplica, maskR esourceId, contentsChangedSinceLastFrame, maskUVRect, m_owningLayer->filters(), m_owningLayer->filter(), m_owningLayer->backgroundFilters()); | 229 quad->SetNew(sharedQuadState, contentRect(), renderPassId, forReplica, maskR esourceId, contentsChangedSinceLastFrame, maskUVRect, m_owningLayer->filters(), m_owningLayer->filter(), m_owningLayer->backgroundFilters()); |
229 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); | 230 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); |
230 } | 231 } |
231 | 232 |
232 } // namespace cc | 233 } // namespace cc |
OLD | NEW |