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

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

Issue 1027513003: Avoid uninitialized memory when decomposing a matrix fails. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/transforms/RotateTransformOperation.cpp » ('j') | 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 30 matching lines...) Expand all
41 return PerspectiveTransformOperation::create(clampTo<int>(p, 0)); 41 return PerspectiveTransformOperation::create(clampTo<int>(p, 0));
42 } 42 }
43 43
44 const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveT ransformOperation*>(from); 44 const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveT ransformOperation*>(from);
45 45
46 TransformationMatrix fromT; 46 TransformationMatrix fromT;
47 TransformationMatrix toT; 47 TransformationMatrix toT;
48 fromT.applyPerspective(fromOp ? fromOp->m_p : 0); 48 fromT.applyPerspective(fromOp ? fromOp->m_p : 0);
49 toT.applyPerspective(m_p); 49 toT.applyPerspective(m_p);
50 toT.blend(fromT, progress); 50 toT.blend(fromT, progress);
51
51 TransformationMatrix::DecomposedType decomp; 52 TransformationMatrix::DecomposedType decomp;
52 toT.decompose(decomp); 53 if (!toT.decompose(decomp)) {
54 // If we can't decompose, bail out of interpolation.
55 const PerspectiveTransformOperation* usedOperation = progress > 0.5 ? th is : fromOp;
56 return PerspectiveTransformOperation::create(usedOperation->perspective( ));
57 }
53 58
54 if (decomp.perspectiveZ) { 59 if (decomp.perspectiveZ) {
55 double val = -1.0 / decomp.perspectiveZ; 60 double val = -1.0 / decomp.perspectiveZ;
56 return PerspectiveTransformOperation::create(clampTo<int>(val, 0)); 61 return PerspectiveTransformOperation::create(clampTo<int>(val, 0));
57 } 62 }
58 return PerspectiveTransformOperation::create(0); 63 return PerspectiveTransformOperation::create(0);
59 } 64 }
60 65
61 } // namespace blink 66 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/transforms/RotateTransformOperation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698