Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/gpu/GrSWMaskHelper.cpp

Issue 2167183002: Minor change to Ganesh path renderers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrSWMaskHelper.h ('k') | src/gpu/GrSoftwarePathRenderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 helper.toTexture(texture); 155 helper.toTexture(texture);
156 156
157 return texture; 157 return texture;
158 } 158 }
159 159
160 void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture, 160 void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
161 GrDrawContext* drawContext, 161 GrDrawContext* drawContext,
162 const GrPaint& paint, 162 const GrPaint& paint,
163 const GrUserStencilSettings* user StencilSettings, 163 const GrUserStencilSettings& user StencilSettings,
164 const GrClip& clip, 164 const GrClip& clip,
165 const SkMatrix& viewMatrix, 165 const SkMatrix& viewMatrix,
166 const SkIRect& rect) { 166 const SkIRect& rect) {
167 SkMatrix invert; 167 SkMatrix invert;
168 if (!viewMatrix.invert(&invert)) { 168 if (!viewMatrix.invert(&invert)) {
169 return; 169 return;
170 } 170 }
171 171
172 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft, 172 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft,
173 SK_Scalar1 * rect.fTop, 173 SK_Scalar1 * rect.fTop,
174 SK_Scalar1 * rect.fRight, 174 SK_Scalar1 * rect.fRight,
175 SK_Scalar1 * rect.fBottom); 175 SK_Scalar1 * rect.fBottom);
176 176
177 // 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
178 // 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
179 // matrix to normalized coords. 179 // matrix to normalized coords.
180 SkMatrix maskMatrix; 180 SkMatrix maskMatrix;
181 maskMatrix.setIDiv(texture->width(), texture->height()); 181 maskMatrix.setIDiv(texture->width(), texture->height());
182 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop )); 182 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop ));
183 183
184 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); 184 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
185 pipelineBuilder.setUserStencil(userStencilSettings); 185 pipelineBuilder.setUserStencil(&userStencilSettings);
186 186
187 pipelineBuilder.addCoverageFragmentProcessor( 187 pipelineBuilder.addCoverageFragmentProcessor(
188 GrSimpleTextureEffect::Make(texture, 188 GrSimpleTextureEffect::Make(texture,
189 nullptr, 189 nullptr,
190 maskMatrix, 190 maskMatrix,
191 GrTextureParams::kNone_Filt erMode, 191 GrTextureParams::kNone_Filt erMode,
192 kDevice_GrCoordSet)); 192 kDevice_GrCoordSet));
193 193
194 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.ge tColor(), 194 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.ge tColor(),
195 SkMatrix ::I(), 195 SkMatrix ::I(),
196 dstRect, nullptr, &invert)); 196 dstRect, nullptr, &invert));
197 drawContext->drawBatch(pipelineBuilder, clip, batch); 197 drawContext->drawBatch(pipelineBuilder, clip, batch);
198 } 198 }
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.h ('k') | src/gpu/GrSoftwarePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698