Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 SkRect clipRect = SkRect::MakeWH(maskRect->width(), maskRect->height()); | 125 SkRect clipRect = SkRect::MakeWH(maskRect->width(), maskRect->height()); |
| 126 | 126 |
| 127 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(mask->asRenderT arget())); | 127 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(mask->asRenderT arget())); |
| 128 if (!drawContext) { | 128 if (!drawContext) { |
| 129 return nullptr; | 129 return nullptr; |
| 130 } | 130 } |
| 131 | 131 |
| 132 drawContext->clear(nullptr, 0x0, true); | 132 drawContext->clear(nullptr, 0x0, true); |
| 133 | 133 |
| 134 GrPaint tempPaint; | 134 GrPaint tempPaint; |
| 135 // SRGBTODO: AllowSRGBInputs? | |
|
bsalomon
2016/04/05 13:24:01
This is creating a mask, shouldn't have to worry a
Brian Osman
2016/04/05 15:36:41
Acknowledged.
| |
| 135 tempPaint.setAntiAlias(doAA); | 136 tempPaint.setAntiAlias(doAA); |
| 136 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); | 137 tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); |
| 137 | 138 |
| 138 // setup new clip | 139 // setup new clip |
| 139 GrClip clip(clipRect); | 140 GrClip clip(clipRect); |
| 140 | 141 |
| 141 // Draw the mask into maskTexture with the path's integerized top-left at | 142 // Draw the mask into maskTexture with the path's integerized top-left at |
| 142 // the origin using tempPaint. | 143 // the origin using tempPaint. |
| 143 SkMatrix translate; | 144 SkMatrix translate; |
| 144 translate.setTranslate(-maskRect->fLeft, -maskRect->fTop); | 145 translate.setTranslate(-maskRect->fLeft, -maskRect->fTop); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 | 222 |
| 222 SkAutoTUnref<GrTexture> mask(create_mask_GPU(context, | 223 SkAutoTUnref<GrTexture> mask(create_mask_GPU(context, |
| 223 &maskRect, | 224 &maskRect, |
| 224 *devPathPtr, | 225 *devPathPtr, |
| 225 strokeInfo, | 226 strokeInfo, |
| 226 paint->isAntiAlias(), | 227 paint->isAntiAlias(), |
| 227 drawContext->numColorSample s())); | 228 drawContext->numColorSample s())); |
| 228 if (mask) { | 229 if (mask) { |
| 229 GrTexture* filtered; | 230 GrTexture* filtered; |
| 230 | 231 |
| 231 if (maskFilter->filterMaskGPU(mask, viewMatrix, maskRect, &filtered, true)) { | 232 if (maskFilter->filterMaskGPU(mask, viewMatrix, maskRect, &filtered, true, |
| 233 paint->getAllowSRGBInputs())) { | |
| 232 // filterMaskGPU gives us ownership of a ref to the result | 234 // filterMaskGPU gives us ownership of a ref to the result |
| 233 SkAutoTUnref<GrTexture> atu(filtered); | 235 SkAutoTUnref<GrTexture> atu(filtered); |
| 234 if (draw_mask(drawContext, clip, viewMatrix, maskRect, paint, fi ltered)) { | 236 if (draw_mask(drawContext, clip, viewMatrix, maskRect, paint, fi ltered)) { |
| 235 // This path is completely drawn | 237 // This path is completely drawn |
| 236 return; | 238 return; |
| 237 } | 239 } |
| 238 } | 240 } |
| 239 } | 241 } |
| 240 } | 242 } |
| 241 | 243 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 | 330 |
| 329 if (!strokeInfo.isDashed() && pathEffect && | 331 if (!strokeInfo.isDashed() && pathEffect && |
| 330 pathEffect->filterPath(tmpPath2.init(), *pathPtr, &strokeInfo, nullptr)) { | 332 pathEffect->filterPath(tmpPath2.init(), *pathPtr, &strokeInfo, nullptr)) { |
| 331 pathPtr = tmpPath2.get(); | 333 pathPtr = tmpPath2.get(); |
| 332 pathPtr->setIsVolatile(true); | 334 pathPtr->setIsVolatile(true); |
| 333 pathIsMutable = true; | 335 pathIsMutable = true; |
| 334 pathEffect = nullptr; | 336 pathEffect = nullptr; |
| 335 } | 337 } |
| 336 | 338 |
| 337 GrPaint grPaint; | 339 GrPaint grPaint; |
| 338 if (!SkPaintToGrPaint(context, paint, viewMatrix, &grPaint)) { | 340 // SRGBTODO: AllowSRGBInputs? (Usually correct, because drawContext came fro m device?) |
| 341 if (!SkPaintToGrPaint(context, paint, viewMatrix, drawContext->allowSRGBInpu ts(), | |
|
bsalomon
2016/04/05 13:24:01
I think this is right.
Brian Osman
2016/04/05 15:36:41
Acknowledged.
| |
| 342 &grPaint)) { | |
| 339 return; | 343 return; |
| 340 } | 344 } |
| 341 | 345 |
| 342 if (paint.getMaskFilter()) { | 346 if (paint.getMaskFilter()) { |
| 343 draw_path_with_mask_filter(context, drawContext, clip, &grPaint, viewMat rix, | 347 draw_path_with_mask_filter(context, drawContext, clip, &grPaint, viewMat rix, |
| 344 paint.getMaskFilter(), pathEffect, strokeInfo , | 348 paint.getMaskFilter(), pathEffect, strokeInfo , |
| 345 pathPtr, pathIsMutable); | 349 pathPtr, pathIsMutable); |
| 346 } else { | 350 } else { |
| 347 drawContext->drawPath(clip, grPaint, viewMatrix, *pathPtr, strokeInfo); | 351 drawContext->drawPath(clip, grPaint, viewMatrix, *pathPtr, strokeInfo); |
| 348 } | 352 } |
| 349 } | 353 } |
| OLD | NEW |