| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2012 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void GradientGeneratedImage::drawTile(GraphicsContext& context, const FloatRect&
srcRect) | 50 void GradientGeneratedImage::drawTile(GraphicsContext& context, const FloatRect&
srcRect) |
| 51 { | 51 { |
| 52 SkPaint gradientPaint(context.fillPaint()); | 52 SkPaint gradientPaint(context.fillPaint()); |
| 53 m_gradient->applyToPaint(gradientPaint); | 53 m_gradient->applyToPaint(gradientPaint); |
| 54 | 54 |
| 55 context.drawRect(srcRect, gradientPaint); | 55 context.drawRect(srcRect, gradientPaint); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool GradientGeneratedImage::applyShader(SkPaint& paint, const SkMatrix* localMa
trix) | 58 bool GradientGeneratedImage::applyShader(SkPaint& paint, const SkMatrix* localMa
trix) |
| 59 { | 59 { |
| 60 AffineTransform transform; | |
| 61 if (localMatrix) { | |
| 62 transform.setMatrix( | |
| 63 localMatrix->getScaleX(), localMatrix->getSkewY(), | |
| 64 localMatrix->getSkewX(), localMatrix->getScaleY(), | |
| 65 localMatrix->getTranslateX(), localMatrix->getTranslateY()); | |
| 66 } | |
| 67 | |
| 68 DCHECK(m_gradient); | 60 DCHECK(m_gradient); |
| 69 // TODO(fmalita): remove the transform from gradient/pattern state, and pass
the matrix to | 61 m_gradient->applyToPaint(paint, localMatrix); |
| 70 // applyToPaint if needed. | |
| 71 const AffineTransform previousTransform = m_gradient->gradientSpaceTransform
(); | |
| 72 m_gradient->setGradientSpaceTransform(transform); | |
| 73 m_gradient->applyToPaint(paint); | |
| 74 m_gradient->setGradientSpaceTransform(previousTransform); | |
| 75 | 62 |
| 76 return true; | 63 return true; |
| 77 } | 64 } |
| 78 | 65 |
| 79 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |