Chromium Code Reviews| Index: cc/texture_draw_quad.cc |
| diff --git a/cc/texture_draw_quad.cc b/cc/texture_draw_quad.cc |
| index adce50fb648676c5c6c4637da6b047e79e3e2092..a921eaa95f1b40702a65e6c67bb4ee8ada4257f2 100644 |
| --- a/cc/texture_draw_quad.cc |
| +++ b/cc/texture_draw_quad.cc |
| @@ -21,7 +21,8 @@ scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() { |
| void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| gfx::Rect rect, gfx::Rect opaque_rect, |
| unsigned resource_id, bool premultiplied_alpha, |
| - const gfx::RectF& uv_rect, |
| + const gfx::PointF& uv_top_left, |
| + const gfx::PointF& uv_bottom_right, |
| const float vertex_opacity[4], bool flipped) { |
| gfx::Rect visible_rect = rect; |
| bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f |
| @@ -30,7 +31,8 @@ void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| opaque_rect, visible_rect, needs_blending); |
| this->resource_id = resource_id; |
| this->premultiplied_alpha = premultiplied_alpha; |
| - this->uv_rect = uv_rect; |
| + this->uv_top_left = uv_top_left; |
| + this->uv_bottom_right = uv_bottom_right; |
| this->vertex_opacity[0] = vertex_opacity[0]; |
| this->vertex_opacity[1] = vertex_opacity[1]; |
| this->vertex_opacity[2] = vertex_opacity[2]; |
| @@ -42,13 +44,15 @@ void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| gfx::Rect rect, gfx::Rect opaque_rect, |
| gfx::Rect visible_rect, bool needs_blending, |
| unsigned resource_id, bool premultiplied_alpha, |
| - const gfx::RectF& uv_rect, |
| + const gfx::PointF& uv_top_left, |
| + const gfx::PointF& uv_bottom_right, |
| const float vertex_opacity[4], bool flipped) { |
| DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, |
| opaque_rect, visible_rect, needs_blending); |
| this->resource_id = resource_id; |
| this->premultiplied_alpha = premultiplied_alpha; |
| - this->uv_rect = uv_rect; |
| + this->uv_top_left = uv_top_left; |
| + this->uv_bottom_right = uv_bottom_right; |
| this->vertex_opacity[0] = vertex_opacity[0]; |
| this->vertex_opacity[1] = vertex_opacity[1]; |
| this->vertex_opacity[2] = vertex_opacity[2]; |
| @@ -86,18 +90,20 @@ bool TextureDrawQuad::PerformClipping() { |
| gfx::RectF clippedRect = IntersectRects(rectF, clipRect()); |
| if (clippedRect.IsEmpty()) { |
| rect = gfx::Rect(); |
| - uv_rect = gfx::RectF(); |
| + uv_top_left = gfx::PointF(); |
| + uv_bottom_right = gfx::PointF(); |
|
danakj
2013/01/11 02:21:51
should this be PointF(1.f, 1.f)
Jerome
2013/01/11 18:00:01
To keep the previous behavior uv_bottom_right shou
|
| return true; |
| } |
| // Create a new uv-rect by clipping the old one to the new bounds. |
| - uv_rect = gfx::RectF( |
| - uv_rect.x() |
| - + uv_rect.width() / rectF.width() * (clippedRect.x() - rectF.x()), |
| - uv_rect.y() |
| - + uv_rect.height() / rectF.height() * (clippedRect.y() - rectF.y()), |
| - uv_rect.width() / rectF.width() * clippedRect.width(), |
| - uv_rect.height() / rectF.height() * clippedRect.height()); |
| + float u_scale = (uv_bottom_right.x() - uv_top_left.x()) / rectF.width(); |
|
danakj
2013/01/11 02:21:51
I might have messed this up, or you might see a mo
Jerome
2013/01/11 18:00:01
LGTM.
Any reason why there is no
void Vector2dF::
danakj
2013/01/11 20:00:12
Ya, I thought about this too.. Ill file a bug
|
| + float v_scale = (uv_bottom_right.y() - uv_top_left.y()) / rectF.height(); |
| + uv_bottom_right = gfx::PointF( |
| + uv_top_left.x() + u_scale * (clippedRect.right() - rectF.x()), |
| + uv_top_left.y() + v_scale * (clippedRect.bottom() - rectF.y())); |
| + uv_top_left = gfx::PointF( |
| + uv_top_left.x() + u_scale * (clippedRect.x() - rectF.x()), |
| + uv_top_left.y() + v_scale * (clippedRect.y() - rectF.y())); |
| // Indexing according to the quad vertex generation: |
| // 1--2 |