| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->endTransparencyLayer(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& ds
tRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode) | 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); | 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())); |
| 91 context->translate(-srcRect.x(), -srcRect.y()); | 91 context->translate(-srcRect.x(), -srcRect.y()); |
| 92 | 92 |
| 93 drawCrossfade(context); | 93 drawCrossfade(context); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatR
ect& srcRect, const FloatSize& scale, const FloatPoint& phase, CompositeOperator
compositeOp, const FloatRect& dstRect, BlendMode) | 96 void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatR
ect& srcRect, const FloatSize& scale, const FloatPoint& phase, CompositeOperator
compositeOp, const FloatRect& dstRect, BlendMode blendMode) |
| 97 { | 97 { |
| 98 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(m_size, 1, context->is
Accelerated() ? Accelerated : Unaccelerated); | 98 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(m_size, 1, context->is
Accelerated() ? Accelerated : Unaccelerated); |
| 99 if (!imageBuffer) | 99 if (!imageBuffer) |
| 100 return; | 100 return; |
| 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); | 107 imageBuffer->drawPattern(context, srcRect, scale, phase, compositeOp, dstRec
t, blendMode); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } | 110 } |
| OLD | NEW |