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" |
11 #include "GrContext.h" | 11 #include "GrContext.h" |
12 #include "batches/GrDrawBatch.h" | 12 #include "batches/GrDrawBatch.h" |
13 #include "GrDrawContext.h" | 13 #include "GrDrawContext.h" |
| 14 #include "GrPipelineBuilder.h" |
14 #include "GrShape.h" | 15 #include "GrShape.h" |
15 | 16 |
16 #include "SkDistanceFieldGen.h" | 17 #include "SkDistanceFieldGen.h" |
17 | 18 |
18 #include "batches/GrRectBatchFactory.h" | 19 #include "batches/GrRectBatchFactory.h" |
19 | 20 |
20 /* | 21 /* |
21 * Convert a boolean operation into a transfer mode code | 22 * Convert a boolean operation into a transfer mode code |
22 */ | 23 */ |
23 static SkXfermode::Mode op_to_mode(SkRegion::Op op) { | 24 static SkXfermode::Mode op_to_mode(SkRegion::Op op) { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 SK_Scalar1 * rect.fRight, | 174 SK_Scalar1 * rect.fRight, |
174 SK_Scalar1 * rect.fBottom); | 175 SK_Scalar1 * rect.fBottom); |
175 | 176 |
176 // We use device coords to compute the texture coordinates. We take the devi
ce coords and apply | 177 // We use device coords to compute the texture coordinates. We take the devi
ce coords and apply |
177 // a translation so that the top-left of the device bounds maps to 0,0, and
then a scaling | 178 // a translation so that the top-left of the device bounds maps to 0,0, and
then a scaling |
178 // matrix to normalized coords. | 179 // matrix to normalized coords. |
179 SkMatrix maskMatrix; | 180 SkMatrix maskMatrix; |
180 maskMatrix.setIDiv(texture->width(), texture->height()); | 181 maskMatrix.setIDiv(texture->width(), texture->height()); |
181 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop
)); | 182 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop
)); |
182 | 183 |
183 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.ge
tColor(), | 184 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); |
184 SkMatrix
::I(), | 185 pipelineBuilder.setUserStencil(&userStencilSettings); |
185 dstRect,
nullptr, &invert)); | |
186 | 186 |
187 GrPaint newPaint(paint); | 187 pipelineBuilder.addCoverageFragmentProcessor( |
188 newPaint.addCoverageFragmentProcessor( | |
189 GrSimpleTextureEffect::Make(texture, | 188 GrSimpleTextureEffect::Make(texture, |
190 nullptr, | 189 nullptr, |
191 maskMatrix, | 190 maskMatrix, |
192 GrTextureParams::kNone_Filt
erMode, | 191 GrTextureParams::kNone_Filt
erMode, |
193 kDevice_GrCoordSet)); | 192 kDevice_GrCoordSet)); |
194 | 193 |
195 drawContext->drawBatch(newPaint, clip, userStencilSettings, batch); | 194 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.ge
tColor(), |
| 195 SkMatrix
::I(), |
| 196 dstRect,
nullptr, &invert)); |
| 197 drawContext->drawBatch(pipelineBuilder, clip, batch); |
196 } | 198 } |
OLD | NEW |