OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 { | 49 { |
50 static_cast<Image*>(info)->deref(); | 50 static_cast<Image*>(info)->deref(); |
51 } | 51 } |
52 | 52 |
53 CGPatternRef Pattern::createPlatformPattern(const TransformationMatrix& userSpac
eTransformation) const | 53 CGPatternRef Pattern::createPlatformPattern(const TransformationMatrix& userSpac
eTransformation) const |
54 { | 54 { |
55 IntRect tileRect = tileImage()->rect(); | 55 IntRect tileRect = tileImage()->rect(); |
56 | 56 |
57 TransformationMatrix patternTransform = m_patternSpaceTransformation; | 57 TransformationMatrix patternTransform = m_patternSpaceTransformation; |
58 patternTransform.multiply(userSpaceTransformation); | 58 patternTransform.multiply(userSpaceTransformation); |
59 patternTransform.scale(1, -1); | 59 patternTransform.scaleNonUniform(1, -1); |
60 patternTransform.translate(0, -tileRect.height()); | 60 patternTransform.translate(0, -tileRect.height()); |
61 | 61 |
62 // If FLT_MAX should also be used for xStep or yStep, nothing is rendered. U
sing fractions of FLT_MAX also | 62 // If FLT_MAX should also be used for xStep or yStep, nothing is rendered. U
sing fractions of FLT_MAX also |
63 // result in nothing being rendered. | 63 // result in nothing being rendered. |
64 // INT_MAX is almost correct, but there seems to be some number wrapping occ
uring making the fill | 64 // INT_MAX is almost correct, but there seems to be some number wrapping occ
uring making the fill |
65 // pattern is not filled correctly. | 65 // pattern is not filled correctly. |
66 // So, just pick a really large number that works. | 66 // So, just pick a really large number that works. |
67 float xStep = m_repeatX ? tileRect.width() : (100000000.0f); | 67 float xStep = m_repeatX ? tileRect.width() : (100000000.0f); |
68 float yStep = m_repeatY ? tileRect.height() : (100000000.0f); | 68 float yStep = m_repeatY ? tileRect.height() : (100000000.0f); |
69 | 69 |
70 // The pattern will release the tile when it's done rendering in patternRele
aseCallback | 70 // The pattern will release the tile when it's done rendering in patternRele
aseCallback |
71 tileImage()->ref(); | 71 tileImage()->ref(); |
72 | 72 |
73 const CGPatternCallbacks patternCallbacks = { 0, patternCallback, patternRel
easeCallback }; | 73 const CGPatternCallbacks patternCallbacks = { 0, patternCallback, patternRel
easeCallback }; |
74 return CGPatternCreate(tileImage(), tileRect, patternTransform, xStep, yStep
, | 74 return CGPatternCreate(tileImage(), tileRect, patternTransform, xStep, yStep
, |
75 kCGPatternTilingConstantSpacing, TRUE, &patternCallbacks); | 75 kCGPatternTilingConstantSpacing, TRUE, &patternCallbacks); |
76 } | 76 } |
77 | 77 |
78 } | 78 } |
OLD | NEW |