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 "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 SK_Scalar1 * rect.fRight, | 178 SK_Scalar1 * rect.fRight, |
179 SK_Scalar1 * rect.fBottom); | 179 SK_Scalar1 * rect.fBottom); |
180 | 180 |
181 // We use device coords to compute the texture coordinates. We take the devi
ce coords and apply | 181 // We use device coords to compute the texture coordinates. We take the devi
ce coords and apply |
182 // a translation so that the top-left of the device bounds maps to 0,0, and
then a scaling | 182 // a translation so that the top-left of the device bounds maps to 0,0, and
then a scaling |
183 // matrix to normalized coords. | 183 // matrix to normalized coords. |
184 SkMatrix maskMatrix; | 184 SkMatrix maskMatrix; |
185 maskMatrix.setIDiv(texture->width(), texture->height()); | 185 maskMatrix.setIDiv(texture->width(), texture->height()); |
186 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop
)); | 186 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop
)); |
187 | 187 |
188 GrPipelineBuilder pipelineBuilder(*paint, drawContext->isUnifiedMultisampled
()); | 188 GrPipelineBuilder pipelineBuilder(*paint, drawContext->mustUseHWAA(*paint)); |
189 pipelineBuilder.setUserStencil(userStencilSettings); | 189 pipelineBuilder.setUserStencil(userStencilSettings); |
190 | 190 |
191 pipelineBuilder.addCoverageFragmentProcessor( | 191 pipelineBuilder.addCoverageFragmentProcessor( |
192 GrSimpleTextureEffect::Create(texture, | 192 GrSimpleTextureEffect::Create(texture, |
193 maskMatrix, | 193 maskMatrix, |
194 GrTextureParams::kNone_Fi
lterMode, | 194 GrTextureParams::kNone_Fi
lterMode, |
195 kDevice_GrCoordSet))->unr
ef(); | 195 kDevice_GrCoordSet))->unr
ef(); |
196 | 196 |
197 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S
kMatrix::I(), | 197 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S
kMatrix::I(), |
198 dstRect,
nullptr, &invert)); | 198 dstRect,
nullptr, &invert)); |
199 drawContext->drawBatch(pipelineBuilder, clip, batch); | 199 drawContext->drawBatch(pipelineBuilder, clip, batch); |
200 } | 200 } |
OLD | NEW |