| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrSWMaskHelper.h" | 8 #include "GrSWMaskHelper.h" |
| 9 | 9 |
| 10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 // We want to use device coords to compute the texture coordinates. We set o
ur matrix to be | 355 // We want to use device coords to compute the texture coordinates. We set o
ur matrix to be |
| 356 // equal to the view matrix followed by a translation so that the top-left o
f the device bounds | 356 // equal to the view matrix followed by a translation so that the top-left o
f the device bounds |
| 357 // maps to 0,0, and then a scaling matrix to normalized coords. We apply thi
s matrix to the | 357 // maps to 0,0, and then a scaling matrix to normalized coords. We apply thi
s matrix to the |
| 358 // vertex positions rather than local coords. | 358 // vertex positions rather than local coords. |
| 359 SkMatrix maskMatrix; | 359 SkMatrix maskMatrix; |
| 360 maskMatrix.setIDiv(texture->width(), texture->height()); | 360 maskMatrix.setIDiv(texture->width(), texture->height()); |
| 361 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop
)); | 361 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop
)); |
| 362 maskMatrix.preConcat(drawState->getViewMatrix()); | 362 maskMatrix.preConcat(drawState->getViewMatrix()); |
| 363 | 363 |
| 364 drawState->addCoverageEffect( | 364 drawState->addCoverageProcessor( |
| 365 GrSimpleTextureEffect::Create(texture, | 365 GrSimpleTextureEffect::Create(texture, |
| 366 maskMatrix, | 366 maskMatrix, |
| 367 GrTextureParams::kNone_Fi
lterMode, | 367 GrTextureParams::kNone_Fi
lterMode, |
| 368 kPosition_GrCoordSet))->u
nref(); | 368 kPosition_GrCoordSet))->u
nref(); |
| 369 | 369 |
| 370 target->drawSimpleRect(dstRect); | 370 target->drawSimpleRect(dstRect); |
| 371 } | 371 } |
| OLD | NEW |