| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 context->restore(); | 61 context->restore(); |
| 62 | 62 |
| 63 // Draw the image we're fading towards. | 63 // Draw the image we're fading towards. |
| 64 context->save(); | 64 context->save(); |
| 65 if (m_crossfadeSize != toImageSize) { | 65 if (m_crossfadeSize != toImageSize) { |
| 66 context->scale( | 66 context->scale( |
| 67 static_cast<float>(m_crossfadeSize.width()) / toImageSize.width(), | 67 static_cast<float>(m_crossfadeSize.width()) / toImageSize.width(), |
| 68 static_cast<float>(m_crossfadeSize.height()) / toImageSize.height())
; | 68 static_cast<float>(m_crossfadeSize.height()) / toImageSize.height())
; |
| 69 } | 69 } |
| 70 context->setAlphaAsFloat(m_percentage); | 70 context->setAlphaAsFloat(m_percentage); |
| 71 context->drawImage(m_toImage, IntPoint(), CompositePlusLighter); | 71 context->drawImage(m_toImage, IntPoint(), SkXfermode::kPlus_Mode); |
| 72 context->restore(); | 72 context->restore(); |
| 73 | 73 |
| 74 context->endLayer(); | 74 context->endLayer(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& ds
tRect, const FloatRect& srcRect, CompositeOperator compositeOp, WebBlendMode ble
ndMode, RespectImageOrientationEnum) | 77 void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& ds
tRect, const FloatRect& srcRect, SkXfermode::Mode compositeOp, RespectImageOrien
tationEnum) |
| 78 { | 78 { |
| 79 // Draw nothing if either of the images hasn't loaded yet. | 79 // Draw nothing if either of the images hasn't loaded yet. |
| 80 if (m_fromImage == Image::nullImage() || m_toImage == Image::nullImage()) | 80 if (m_fromImage == Image::nullImage() || m_toImage == Image::nullImage()) |
| 81 return; | 81 return; |
| 82 | 82 |
| 83 GraphicsContextStateSaver stateSaver(*context); | 83 GraphicsContextStateSaver stateSaver(*context); |
| 84 context->setCompositeOperation(WebCoreCompositeToSkiaComposite(compositeOp,
blendMode)); | 84 context->setCompositeOperation(compositeOp); |
| 85 context->clip(dstRect); | 85 context->clip(dstRect); |
| 86 context->translate(dstRect.x(), dstRect.y()); | 86 context->translate(dstRect.x(), dstRect.y()); |
| 87 if (dstRect.size() != srcRect.size()) | 87 if (dstRect.size() != srcRect.size()) |
| 88 context->scale(dstRect.width() / srcRect.width(), dstRect.height() / src
Rect.height()); | 88 context->scale(dstRect.width() / srcRect.width(), dstRect.height() / src
Rect.height()); |
| 89 context->translate(-srcRect.x(), -srcRect.y()); | 89 context->translate(-srcRect.x(), -srcRect.y()); |
| 90 | 90 |
| 91 drawCrossfade(context); | 91 drawCrossfade(context); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void CrossfadeGeneratedImage::drawTile(GraphicsContext* context, const FloatRect
& srcRect) | 94 void CrossfadeGeneratedImage::drawTile(GraphicsContext* context, const FloatRect
& srcRect) |
| 95 { | 95 { |
| 96 // Draw nothing if either of the images hasn't loaded yet. | 96 // Draw nothing if either of the images hasn't loaded yet. |
| 97 if (m_fromImage == Image::nullImage() || m_toImage == Image::nullImage()) | 97 if (m_fromImage == Image::nullImage() || m_toImage == Image::nullImage()) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 drawCrossfade(context); | 100 drawCrossfade(context); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |