| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // Draw the image we're fading towards. | 71 // Draw the image we're fading towards. |
| 72 context->save(); | 72 context->save(); |
| 73 if (m_crossfadeSize != toImageSize) | 73 if (m_crossfadeSize != toImageSize) |
| 74 context->scale(FloatSize(static_cast<float>(m_crossfadeSize.width()) / t
oImageSize.width(), | 74 context->scale(FloatSize(static_cast<float>(m_crossfadeSize.width()) / t
oImageSize.width(), |
| 75 static_cast<float>(m_crossfadeSize.height()) /
toImageSize.height())); | 75 static_cast<float>(m_crossfadeSize.height()) /
toImageSize.height())); |
| 76 context->setAlpha(m_percentage); | 76 context->setAlpha(m_percentage); |
| 77 context->drawImage(m_toImage, IntPoint(), CompositePlusLighter); | 77 context->drawImage(m_toImage, IntPoint(), CompositePlusLighter); |
| 78 context->restore(); | 78 context->restore(); |
| 79 | 79 |
| 80 context->endTransparencyLayer(); | 80 context->endLayer(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& ds
tRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendM
ode) | 83 void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& ds
tRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendM
ode) |
| 84 { | 84 { |
| 85 GraphicsContextStateSaver stateSaver(*context); | 85 GraphicsContextStateSaver stateSaver(*context); |
| 86 context->setCompositeOperation(compositeOp, blendMode); | 86 context->setCompositeOperation(compositeOp, blendMode); |
| 87 context->clip(dstRect); | 87 context->clip(dstRect); |
| 88 context->translate(dstRect.x(), dstRect.y()); | 88 context->translate(dstRect.x(), dstRect.y()); |
| 89 if (dstRect.size() != srcRect.size()) | 89 if (dstRect.size() != srcRect.size()) |
| 90 context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.heig
ht() / srcRect.height())); | 90 context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.heig
ht() / srcRect.height())); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 101 | 101 |
| 102 // Fill with the cross-faded image. | 102 // Fill with the cross-faded image. |
| 103 GraphicsContext* graphicsContext = imageBuffer->context(); | 103 GraphicsContext* graphicsContext = imageBuffer->context(); |
| 104 drawCrossfade(graphicsContext); | 104 drawCrossfade(graphicsContext); |
| 105 | 105 |
| 106 // Tile the image buffer into the context. | 106 // Tile the image buffer into the context. |
| 107 imageBuffer->drawPattern(context, srcRect, scale, phase, compositeOp, dstRec
t, blendMode); | 107 imageBuffer->drawPattern(context, srcRect, scale, phase, compositeOp, dstRec
t, blendMode); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } | 110 } |
| OLD | NEW |