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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrBlurUtils.h" 8 #include "GrBlurUtils.h"
9 #include "GrDrawContext.h" 9 #include "GrDrawContext.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 25 matching lines...) Expand all
36 matrix.setTranslate(-maskRect.fLeft, -maskRect.fTop); 36 matrix.setTranslate(-maskRect.fLeft, -maskRect.fTop);
37 matrix.postIDiv(mask->width(), mask->height()); 37 matrix.postIDiv(mask->width(), mask->height());
38 38
39 grp->addCoverageProcessor(GrSimpleTextureEffect::Create(mask, matrix, 39 grp->addCoverageProcessor(GrSimpleTextureEffect::Create(mask, matrix,
40 kDevice_GrCoordSet)) ->unref(); 40 kDevice_GrCoordSet)) ->unref();
41 41
42 SkMatrix inverse; 42 SkMatrix inverse;
43 if (!viewMatrix.invert(&inverse)) { 43 if (!viewMatrix.invert(&inverse)) {
44 return false; 44 return false;
45 } 45 }
46
47 drawContext->uses(mask);
46 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), mas kRect, inverse); 48 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), mas kRect, inverse);
47 return true; 49 return true;
48 } 50 }
49 51
50 static bool draw_with_mask_filter(GrDrawContext* drawContext, 52 static bool draw_with_mask_filter(GrDrawContext* drawContext,
51 GrTextureProvider* textureProvider, 53 GrTextureProvider* textureProvider,
52 GrRenderTarget* rt, 54 GrRenderTarget* rt,
53 const GrClip& clipData, 55 const GrClip& clipData,
54 const SkMatrix& viewMatrix, 56 const SkMatrix& viewMatrix,
55 const SkPath& devPath, 57 const SkPath& devPath,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 118 }
117 119
118 GrTexture* mask = context->textureProvider()->refScratchTexture( 120 GrTexture* mask = context->textureProvider()->refScratchTexture(
119 desc, GrTextureProvider::kApprox_ScratchTexMatch); 121 desc, GrTextureProvider::kApprox_ScratchTexMatch);
120 if (NULL == mask) { 122 if (NULL == mask) {
121 return NULL; 123 return NULL;
122 } 124 }
123 125
124 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); 126 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height());
125 127
126 GrDrawContext* drawContext = context->drawContext(); 128 // TODO: need to propagate this drawcontext back to the caller
129 GrDrawContext* drawContext = context->drawContext(mask->asRenderTarget());
127 if (!drawContext) { 130 if (!drawContext) {
128 return NULL; 131 return NULL;
129 } 132 }
130 133
131 drawContext->clear(mask->asRenderTarget(), NULL, 0x0, true); 134 drawContext->clear(mask->asRenderTarget(), NULL, 0x0, true);
132 135
133 GrPaint tempPaint; 136 GrPaint tempPaint;
134 tempPaint.setAntiAlias(doAA); 137 tempPaint.setAntiAlias(doAA);
135 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); 138 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
136 139
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 viewMatrix, 238 viewMatrix,
236 &maskRect)) { 239 &maskRect)) {
237 SkIRect finalIRect; 240 SkIRect finalIRect;
238 maskRect.roundOut(&finalIRect); 241 maskRect.roundOut(&finalIRect);
239 if (clip_bounds_quick_reject(clipBounds, finalIRect)) { 242 if (clip_bounds_quick_reject(clipBounds, finalIRect)) {
240 // clipped out 243 // clipped out
241 return; 244 return;
242 } 245 }
243 246
244 if (paint.getMaskFilter()->directFilterMaskGPU(context, 247 if (paint.getMaskFilter()->directFilterMaskGPU(context,
248 drawContext,
245 renderTarget, 249 renderTarget,
246 &grPaint, 250 &grPaint,
247 clip, 251 clip,
248 viewMatrix, 252 viewMatrix,
249 strokeInfo, 253 strokeInfo,
250 *devPathPtr)) { 254 *devPathPtr)) {
251 // the mask filter was able to draw itself directly, so there's nothing 255 // the mask filter was able to draw itself directly, so there's nothing
252 // left to do. 256 // left to do.
253 return; 257 return;
254 } 258 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 SkPaint::kFill_Sty le; 291 SkPaint::kFill_Sty le;
288 draw_with_mask_filter(drawContext, context->textureProvider(), renderTar get, 292 draw_with_mask_filter(drawContext, context->textureProvider(), renderTar get,
289 clip, viewMatrix, *devPathPtr, 293 clip, viewMatrix, *devPathPtr,
290 paint.getMaskFilter(), clipBounds, &grPaint, style ); 294 paint.getMaskFilter(), clipBounds, &grPaint, style );
291 return; 295 return;
292 } 296 }
293 297
294 drawContext->drawPath(renderTarget, clip, grPaint, viewMatrix, *pathPtr, str okeInfo); 298 drawContext->drawPath(renderTarget, clip, grPaint, viewMatrix, *pathPtr, str okeInfo);
295 } 299 }
296 300
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698