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