Chromium Code Reviews| Index: src/core/SkDevice.cpp |
| diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp |
| index d22b22752d23852e676fd18b4c8e0f445ba40fb3..8ba5801f31f1265efd3063f654b41392d7e5c946 100644 |
| --- a/src/core/SkDevice.cpp |
| +++ b/src/core/SkDevice.cpp |
| @@ -9,6 +9,7 @@ |
| #include "SkDraw.h" |
| #include "SkMetaData.h" |
| #include "SkPatchUtils.h" |
| +#include "SkShader.h" |
| #include "SkTextBlob.h" |
| SkBaseDevice::SkBaseDevice() |
| @@ -98,6 +99,7 @@ void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPoint cubics[12], const |
| void SkBaseDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkScalar x, SkScalar y, |
| const SkPaint &paint) { |
| + SkPaint runPaint = paint; |
| SkMatrix localMatrix; |
| SkDraw localDraw(draw); |
| @@ -105,9 +107,18 @@ void SkBaseDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSc |
| localMatrix = *draw.fMatrix; |
| localMatrix.preTranslate(x, y); |
| localDraw.fMatrix = &localMatrix; |
| + |
| + if (paint.getShader()) { |
|
reed1
2014/09/19 16:47:19
Tricky, but seems fine for now.
Perhaps a TODO to
f(malita)
2014/09/19 17:55:53
Done.
|
| + // FIXME: We need to compensate for the translate above. This is suboptimal but |
| + // temporary -- until we get proper derived class drawTextBlob implementations. |
| + SkMatrix shaderMatrix; |
| + shaderMatrix.setTranslate(-x, -y); |
| + SkAutoTUnref<SkShader> wrapper( |
| + SkShader::CreateLocalMatrixShader(paint.getShader(), shaderMatrix)); |
| + runPaint.setShader(wrapper); |
| + } |
| } |
| - SkPaint runPaint = paint; |
| SkTextBlob::RunIterator it(blob); |
| while (!it.done()) { |
| size_t textLen = it.glyphCount() * sizeof(uint16_t); |