Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const Transf ormOperation* from, double progress, bool blendToIdentity) | 36 PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const Transf ormOperation* from, double progress, bool blendToIdentity) |
| 37 { | 37 { |
| 38 if (from && !from->isSameType(*this)) | 38 if (from && !from->isSameType(*this)) |
| 39 return this; | 39 return this; |
| 40 | 40 |
| 41 if (blendToIdentity) { | 41 if (blendToIdentity) { |
| 42 double p = floatValueForLength(m_p, 1); | 42 double p = floatValueForLength(m_p, 1); |
| 43 p = WebCore::blend(p, 1.0, progress); // FIXME: this seems wrong. https: //bugs.webkit.org/show_bug.cgi?id=52700 | 43 p = 1.0 / WebCore::blend(1.0 / p, 0.0, progress); |
|
Julien - ping for review
2013/12/05 01:18:45
This formula is overly complicated and it took me
| |
| 44 return PerspectiveTransformOperation::create(Length(clampToPositiveInteg er(p), Fixed)); | 44 return PerspectiveTransformOperation::create(Length(clampToPositiveInteg er(p), Fixed)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveT ransformOperation*>(from); | 47 const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveT ransformOperation*>(from); |
| 48 Length fromP = fromOp ? fromOp->m_p : Length(m_p.type()); | 48 Length fromP = fromOp ? fromOp->m_p : Length(m_p.type()); |
| 49 Length toP = m_p; | 49 Length toP = m_p; |
| 50 | 50 |
| 51 TransformationMatrix fromT; | 51 TransformationMatrix fromT; |
| 52 TransformationMatrix toT; | 52 TransformationMatrix toT; |
| 53 fromT.applyPerspective(floatValueForLength(fromP, 1)); | 53 fromT.applyPerspective(floatValueForLength(fromP, 1)); |
| 54 toT.applyPerspective(floatValueForLength(toP, 1)); | 54 toT.applyPerspective(floatValueForLength(toP, 1)); |
| 55 toT.blend(fromT, progress); | 55 toT.blend(fromT, progress); |
| 56 TransformationMatrix::DecomposedType decomp; | 56 TransformationMatrix::DecomposedType decomp; |
| 57 toT.decompose(decomp); | 57 toT.decompose(decomp); |
| 58 | 58 |
| 59 if (decomp.perspectiveZ) { | 59 if (decomp.perspectiveZ) { |
| 60 double val = -1.0 / decomp.perspectiveZ; | 60 double val = -1.0 / decomp.perspectiveZ; |
| 61 return PerspectiveTransformOperation::create(Length(clampToPositiveInteg er(val), Fixed)); | 61 return PerspectiveTransformOperation::create(Length(clampToPositiveInteg er(val), Fixed)); |
| 62 } | 62 } |
| 63 return PerspectiveTransformOperation::create(Length(0, Fixed)); | 63 return PerspectiveTransformOperation::create(Length(0, Fixed)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace WebCore | 66 } // namespace WebCore |
| OLD | NEW |