Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: Source/platform/transforms/PerspectiveTransformOperation.cpp

Issue 73493002: Fix blendToIdentity case in PerspectiveTransformOperation::blend Base URL: http://src.chromium.org/blink/trunk/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/animations/3d/transform-perspective.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « LayoutTests/animations/3d/transform-perspective.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698