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

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

Issue 1966903004: Remove clip from GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@fix2_nvpr
Patch Set: Created 4 years, 7 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 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 "GrClipMaskManager.h" 8 #include "GrClipMaskManager.h"
9 #include "GrCaps.h" 9 #include "GrCaps.h"
10 #include "GrDrawingManager.h" 10 #include "GrDrawingManager.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return GrTextureDomainEffect::Create(result, 43 return GrTextureDomainEffect::Create(result,
44 mat, 44 mat,
45 GrTextureDomain::MakeTexelDomain(result , domainTexels), 45 GrTextureDomain::MakeTexelDomain(result , domainTexels),
46 GrTextureDomain::kDecal_Mode, 46 GrTextureDomain::kDecal_Mode,
47 GrTextureParams::kNone_FilterMode, 47 GrTextureParams::kNone_FilterMode,
48 kDevice_GrCoordSet); 48 kDevice_GrCoordSet);
49 } 49 }
50 50
51 static void draw_non_aa_rect(GrDrawTarget* drawTarget, 51 static void draw_non_aa_rect(GrDrawTarget* drawTarget,
52 const GrPipelineBuilder& pipelineBuilder, 52 const GrPipelineBuilder& pipelineBuilder,
53 const GrClip& clip,
53 GrColor color, 54 GrColor color,
54 const SkMatrix& viewMatrix, 55 const SkMatrix& viewMatrix,
55 const SkRect& rect) { 56 const SkRect& rect) {
56 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, v iewMatrix, rect, 57 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, v iewMatrix, rect,
57 nullptr, nullptr)); 58 nullptr, nullptr));
58 drawTarget->drawBatch(pipelineBuilder, batch); 59 drawTarget->drawBatch(pipelineBuilder, clip, batch);
59 } 60 }
60 61
61 // Does the path in 'element' require SW rendering? If so, return true (and, 62 // Does the path in 'element' require SW rendering? If so, return true (and,
62 // optionally, set 'prOut' to NULL. If not, return false (and, optionally, set 63 // optionally, set 'prOut' to NULL. If not, return false (and, optionally, set
63 // 'prOut' to the non-SW path renderer that will do the job). 64 // 'prOut' to the non-SW path renderer that will do the job).
64 bool GrClipMaskManager::PathNeedsSWRenderer(GrContext* context, 65 bool GrClipMaskManager::PathNeedsSWRenderer(GrContext* context,
65 bool hasUserStencilSettings, 66 bool hasUserStencilSettings,
66 const GrRenderTarget* rt, 67 const GrRenderTarget* rt,
67 const SkMatrix& viewMatrix, 68 const SkMatrix& viewMatrix,
68 const Element* element, 69 const Element* element,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 PathNeedsSWRenderer(context, 130 PathNeedsSWRenderer(context,
130 kHasUserStencilSettings, 131 kHasUserStencilSettings,
131 texture->asRenderTarget(), 132 texture->asRenderTarget(),
132 viewMatrix, 133 viewMatrix,
133 element, 134 element,
134 &pr, 135 &pr,
135 kNeedsStencil); 136 kNeedsStencil);
136 return pr; 137 return pr;
137 } 138 }
138 139
139 GrClipMaskManager::GrClipMaskManager(GrDrawTarget* drawTarget, bool debugClipBat chToBounds) 140 GrClipMaskManager::GrClipMaskManager(GrDrawTarget* drawTarget)
140 : fDrawTarget(drawTarget) 141 : fDrawTarget(drawTarget)
141 , fClipMode(kIgnoreClip_StencilClipMode) 142 , fClipMode(kIgnoreClip_StencilClipMode) {
142 , fDebugClipBatchToBounds(debugClipBatchToBounds) {
143 } 143 }
144 144
145 GrContext* GrClipMaskManager::getContext() { 145 GrContext* GrClipMaskManager::getContext() {
146 return fDrawTarget->cmmAccess().context(); 146 return fDrawTarget->cmmAccess().context();
147 } 147 }
148 148
149 const GrCaps* GrClipMaskManager::caps() const { 149 const GrCaps* GrClipMaskManager::caps() const {
150 return fDrawTarget->caps(); 150 return fDrawTarget->caps();
151 } 151 }
152 152
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 *resultFP = nullptr; 277 *resultFP = nullptr;
278 if (!failed && fpCnt) { 278 if (!failed && fpCnt) {
279 *resultFP = GrFragmentProcessor::RunInSeries(fps, fpCnt); 279 *resultFP = GrFragmentProcessor::RunInSeries(fps, fpCnt);
280 } 280 }
281 for (int i = 0; i < fpCnt; ++i) { 281 for (int i = 0; i < fpCnt; ++i) {
282 fps[i]->unref(); 282 fps[i]->unref();
283 } 283 }
284 return !failed; 284 return !failed;
285 } 285 }
286 286
287 static void add_rect_to_clip(const GrClip& clip, const SkRect& devRect, GrClip* out) {
288 switch (clip.clipType()) {
289 case GrClip::kClipStack_ClipType: {
290 SkClipStack* stack = new SkClipStack;
291 *stack = *clip.clipStack();
292 // The stack is actually in clip space not device space.
293 SkRect clipRect = devRect;
294 SkPoint origin = { SkIntToScalar(clip.origin().fX), SkIntToScalar(cl ip.origin().fY) };
295 clipRect.offset(origin);
296 SkIRect iclipRect;
297 clipRect.roundOut(&iclipRect);
298 clipRect = SkRect::Make(iclipRect);
299 stack->clipDevRect(clipRect, SkRegion::kIntersect_Op, false);
300 out->setClipStack(stack, &clip.origin());
301 break;
302 }
303 case GrClip::kWideOpen_ClipType:
304 *out = GrClip(devRect);
305 break;
306 case GrClip::kIRect_ClipType: {
307 SkIRect intersect;
308 devRect.roundOut(&intersect);
309 if (intersect.intersect(clip.irect())) {
310 *out = GrClip(intersect);
311 } else {
312 *out = clip;
313 }
314 break;
315 }
316 }
317 }
318
319 bool GrClipMaskManager::setupScissorClip(const GrPipelineBuilder& pipelineBuilde r,
320 const SkIRect& clipScissor,
321 const SkRect* devBounds,
322 GrAppliedClip* out) {
323 SkASSERT(kModifyClip_StencilClipMode != fClipMode); // TODO: Remove fClipMod e.
324 fClipMode = kIgnoreClip_StencilClipMode;
325
326 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
327
328 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
329 SkIRect devBoundsScissor;
330 const SkIRect* scissor = &clipScissor;
331 bool doDevBoundsClip = fDebugClipBatchToBounds && devBounds;
332 if (doDevBoundsClip) {
333 devBounds->roundOut(&devBoundsScissor);
334 if (devBoundsScissor.intersect(clipScissor)) {
335 scissor = &devBoundsScissor;
336 }
337 }
338
339 if (scissor->contains(clipSpaceRTIBounds)) {
340 // This counts as wide open
341 return true;
342 }
343
344 if (clipSpaceRTIBounds.intersect(*scissor)) {
345 out->fScissorState.set(clipSpaceRTIBounds);
346 return true;
347 }
348 return false;
349 }
350
351 //////////////////////////////////////////////////////////////////////////////// 287 ////////////////////////////////////////////////////////////////////////////////
352 // sort out what kind of clip mask needs to be created: alpha, stencil, 288 // sort out what kind of clip mask needs to be created: alpha, stencil,
353 // scissor, or entirely software 289 // scissor, or entirely software
354 bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder, 290 bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
291 const GrClip& clip,
355 const SkRect* devBounds, 292 const SkRect* devBounds,
356 GrAppliedClip* out) { 293 GrAppliedClip* out) {
357 if (kRespectClip_StencilClipMode == fClipMode) { 294 if (kRespectClip_StencilClipMode == fClipMode) {
358 fClipMode = kIgnoreClip_StencilClipMode; 295 fClipMode = kIgnoreClip_StencilClipMode;
359 } 296 }
360 297
361 GrReducedClip::ElementList elements; 298 GrReducedClip::ElementList elements;
362 int32_t genID = 0; 299 int32_t genID = 0;
363 GrReducedClip::InitialState initialState = GrReducedClip::kAllIn_InitialStat e; 300 GrReducedClip::InitialState initialState = GrReducedClip::kAllIn_InitialStat e;
364 SkIRect clipSpaceIBounds; 301 SkIRect clipSpaceIBounds;
365 bool requiresAA = false; 302 bool requiresAA = false;
366 GrRenderTarget* rt = pipelineBuilder.getRenderTarget(); 303 GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
367 304
368 // GrDrawTarget should have filtered this for us 305 // GrDrawTarget should have filtered this for us
369 SkASSERT(rt); 306 SkASSERT(rt);
370 307
371 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height()); 308 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
372 GrClip devBoundsClip;
373 bool doDevBoundsClip = fDebugClipBatchToBounds && devBounds;
374 if (doDevBoundsClip) {
375 add_rect_to_clip(pipelineBuilder.clip(), *devBounds, &devBoundsClip);
376 }
377 const GrClip& clip = doDevBoundsClip ? devBoundsClip : pipelineBuilder.clip( );
378
379 if (clip.isWideOpen(clipSpaceRTIBounds)) { 309 if (clip.isWideOpen(clipSpaceRTIBounds)) {
380 return true; 310 return true;
381 } 311 }
382 312
383 // The clip mask manager always draws with a single IRect so we special case that logic here 313 // The clip mask manager always draws with a single IRect so we special case that logic here
384 // Image filters just use a rect, so we also special case that logic 314 // Image filters just use a rect, so we also special case that logic
385 switch (clip.clipType()) { 315 switch (clip.clipType()) {
386 case GrClip::kWideOpen_ClipType: 316 case GrClip::kWideOpen_ClipType:
387 SkFAIL("Should have caught this with clip.isWideOpen()"); 317 SkFAIL("Should have caught this with clip.isWideOpen()");
388 return true; 318 return true;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // use both stencil and scissor test to the bounds for the final draw. 451 // use both stencil and scissor test to the bounds for the final draw.
522 SkIRect scissorSpaceIBounds(clipSpaceIBounds); 452 SkIRect scissorSpaceIBounds(clipSpaceIBounds);
523 scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset); 453 scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset);
524 out->fScissorState.set(scissorSpaceIBounds); 454 out->fScissorState.set(scissorSpaceIBounds);
525 SkASSERT(kRespectClip_StencilClipMode == fClipMode); // TODO: Remove fClipMo de. 455 SkASSERT(kRespectClip_StencilClipMode == fClipMode); // TODO: Remove fClipMo de.
526 out->fHasStencilClip = true; 456 out->fHasStencilClip = true;
527 return true; 457 return true;
528 } 458 }
529 459
530 static bool stencil_element(GrDrawContext* dc, 460 static bool stencil_element(GrDrawContext* dc,
531 const SkIRect* scissorRect, 461 const GrClip& clip,
532 const GrUserStencilSettings* ss, 462 const GrUserStencilSettings* ss,
533 const SkMatrix& viewMatrix, 463 const SkMatrix& viewMatrix,
534 const SkClipStack::Element* element) { 464 const SkClipStack::Element* element) {
535 465
536 // TODO: Draw rrects directly here. 466 // TODO: Draw rrects directly here.
537 switch (element->getType()) { 467 switch (element->getType()) {
538 case Element::kEmpty_Type: 468 case Element::kEmpty_Type:
539 SkDEBUGFAIL("Should never get here with an empty element."); 469 SkDEBUGFAIL("Should never get here with an empty element.");
540 break; 470 break;
541 case Element::kRect_Type: 471 case Element::kRect_Type:
542 return dc->drawContextPriv().drawAndStencilRect(scissorRect, ss, 472 return dc->drawContextPriv().drawAndStencilRect(clip, ss,
543 element->getOp(), 473 element->getOp(),
544 element->isInverseFi lled(), 474 element->isInverseFi lled(),
545 element->isAA(), 475 element->isAA(),
546 viewMatrix, element- >getRect()); 476 viewMatrix, element- >getRect());
547 break; 477 break;
548 default: { 478 default: {
549 SkPath path; 479 SkPath path;
550 element->asPath(&path); 480 element->asPath(&path);
551 if (path.isInverseFillType()) { 481 if (path.isInverseFillType()) {
552 path.toggleInverseFillType(); 482 path.toggleInverseFillType();
553 } 483 }
554 484
555 return dc->drawContextPriv().drawAndStencilPath(scissorRect, ss, 485 return dc->drawContextPriv().drawAndStencilPath(clip, ss,
556 element->getOp(), 486 element->getOp(),
557 element->isInverseFi lled(), 487 element->isInverseFi lled(),
558 element->isAA(), vie wMatrix, path); 488 element->isAA(), vie wMatrix, path);
559 break; 489 break;
560 } 490 }
561 } 491 }
562 492
563 return false; 493 return false;
564 } 494 }
565 495
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 GrPathRenderer* pr = GetPathRenderer(context, 596 GrPathRenderer* pr = GetPathRenderer(context,
667 texture, translate, element); 597 texture, translate, element);
668 if (Element::kRect_Type != element->getType() && !pr) { 598 if (Element::kRect_Type != element->getType() && !pr) {
669 // UseSWOnlyPath should now filter out all cases where gpu-side mask merging would 599 // UseSWOnlyPath should now filter out all cases where gpu-side mask merging would
670 // be performed (i.e., pr would be NULL for a non-rect path). 600 // be performed (i.e., pr would be NULL for a non-rect path).
671 // See https://bug.skia.org/4519 for rationale and details. 601 // See https://bug.skia.org/4519 for rationale and details.
672 SkASSERT(0); 602 SkASSERT(0);
673 } 603 }
674 #endif 604 #endif
675 605
606 GrClip clip(maskSpaceIBounds);
607
676 // draw directly into the result with the stencil set to make the pi xels affected 608 // draw directly into the result with the stencil set to make the pi xels affected
677 // by the clip shape be non-zero. 609 // by the clip shape be non-zero.
678 static constexpr GrUserStencilSettings kStencilInElement( 610 static constexpr GrUserStencilSettings kStencilInElement(
679 GrUserStencilSettings::StaticInit< 611 GrUserStencilSettings::StaticInit<
680 0xffff, 612 0xffff,
681 GrUserStencilTest::kAlways, 613 GrUserStencilTest::kAlways,
682 0xffff, 614 0xffff,
683 GrUserStencilOp::kReplace, 615 GrUserStencilOp::kReplace,
684 GrUserStencilOp::kReplace, 616 GrUserStencilOp::kReplace,
685 0xffff>() 617 0xffff>()
686 ); 618 );
687 if (!stencil_element(dc.get(), &maskSpaceIBounds, &kStencilInElement , 619 if (!stencil_element(dc.get(), clip, &kStencilInElement,
688 translate, element)) { 620 translate, element)) {
689 texture->resourcePriv().removeUniqueKey(); 621 texture->resourcePriv().removeUniqueKey();
690 return nullptr; 622 return nullptr;
691 } 623 }
692 624
693 // Draw to the exterior pixels (those with a zero stencil value). 625 // Draw to the exterior pixels (those with a zero stencil value).
694 static constexpr GrUserStencilSettings kDrawOutsideElement( 626 static constexpr GrUserStencilSettings kDrawOutsideElement(
695 GrUserStencilSettings::StaticInit< 627 GrUserStencilSettings::StaticInit<
696 0x0000, 628 0x0000,
697 GrUserStencilTest::kEqual, 629 GrUserStencilTest::kEqual,
698 0xffff, 630 0xffff,
699 GrUserStencilOp::kZero, 631 GrUserStencilOp::kZero,
700 GrUserStencilOp::kZero, 632 GrUserStencilOp::kZero,
701 0xffff>() 633 0xffff>()
702 ); 634 );
703 if (!dc->drawContextPriv().drawAndStencilRect(&maskSpaceIBounds, &kD rawOutsideElement, 635 if (!dc->drawContextPriv().drawAndStencilRect(clip, &kDrawOutsideEle ment,
704 op, !invert, false, 636 op, !invert, false,
705 translate, 637 translate,
706 SkRect::Make(clipSpace IBounds))) { 638 SkRect::Make(clipSpace IBounds))) {
707 texture->resourcePriv().removeUniqueKey(); 639 texture->resourcePriv().removeUniqueKey();
708 return nullptr; 640 return nullptr;
709 } 641 }
710 } else { 642 } else {
711 // all the remaining ops can just be directly draw into the accumula tion buffer 643 // all the remaining ops can just be directly draw into the accumula tion buffer
712 GrPaint paint; 644 GrPaint paint;
713 paint.setAntiAlias(element->isAA()); 645 paint.setAntiAlias(element->isAA());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 685
754 fDrawTarget->cmmAccess().clearStencilClip(stencilSpaceIBounds, 686 fDrawTarget->cmmAccess().clearStencilClip(stencilSpaceIBounds,
755 GrReducedClip::kAllIn_InitialState == initialState, rt); 687 GrReducedClip::kAllIn_InitialState == initialState, rt);
756 688
757 // walk through each clip element and perform its set op 689 // walk through each clip element and perform its set op
758 // with the existing clip. 690 // with the existing clip.
759 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge t(); iter.next()) { 691 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge t(); iter.next()) {
760 const Element* element = iter.get(); 692 const Element* element = iter.get();
761 693
762 GrPipelineBuilder pipelineBuilder; 694 GrPipelineBuilder pipelineBuilder;
763 pipelineBuilder.setClip(clip);
764 pipelineBuilder.setRenderTarget(rt); 695 pipelineBuilder.setRenderTarget(rt);
765 696
766 pipelineBuilder.setDisableColorXPFactory(); 697 pipelineBuilder.setDisableColorXPFactory();
767 698
768 // if the target is MSAA then we want MSAA enabled when the clip is soft 699 // if the target is MSAA then we want MSAA enabled when the clip is soft
769 if (rt->isStencilBufferMultisampled()) { 700 if (rt->isStencilBufferMultisampled()) {
770 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, e lement->isAA()); 701 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, e lement->isAA());
771 } 702 }
772 703
773 bool fillInverted = false; 704 bool fillInverted = false;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 0x0000, 759 0x0000,
829 GrUserStencilTest::kAlways, 760 GrUserStencilTest::kAlways,
830 0xffff, 761 0xffff,
831 GrUserStencilOp::kIncMaybeClamp, 762 GrUserStencilOp::kIncMaybeClamp,
832 GrUserStencilOp::kIncMaybeClamp, 763 GrUserStencilOp::kIncMaybeClamp,
833 0xffff>() 764 0xffff>()
834 ); 765 );
835 if (Element::kRect_Type == element->getType()) { 766 if (Element::kRect_Type == element->getType()) {
836 pipelineBuilder.setUserStencil(&kDrawToStencil); 767 pipelineBuilder.setUserStencil(&kDrawToStencil);
837 768
838 draw_non_aa_rect(fDrawTarget, pipelineBuilder, GrColor_WHITE , viewMatrix, 769 draw_non_aa_rect(fDrawTarget, pipelineBuilder, clip, GrColor _WHITE, viewMatrix,
839 element->getRect()); 770 element->getRect());
840 } else { 771 } else {
841 if (!clipPath.isEmpty()) { 772 if (!clipPath.isEmpty()) {
842 if (canRenderDirectToStencil) { 773 if (canRenderDirectToStencil) {
843 pipelineBuilder.setUserStencil(&kDrawToStencil); 774 pipelineBuilder.setUserStencil(&kDrawToStencil);
844 775
845 GrPathRenderer::DrawPathArgs args; 776 GrPathRenderer::DrawPathArgs args;
846 args.fTarget = fDrawTarget; 777 args.fTarget = fDrawTarget;
847 args.fResourceProvider = this->getContext()->resourc eProvider(); 778 args.fResourceProvider = this->getContext()->resourc eProvider();
848 args.fPipelineBuilder = &pipelineBuilder; 779 args.fPipelineBuilder = &pipelineBuilder;
780 args.fClip = &clip;
849 args.fColor = GrColor_WHITE; 781 args.fColor = GrColor_WHITE;
850 args.fViewMatrix = &viewMatrix; 782 args.fViewMatrix = &viewMatrix;
851 args.fPath = &clipPath; 783 args.fPath = &clipPath;
852 args.fStyle = &GrStyle::SimpleFill(); 784 args.fStyle = &GrStyle::SimpleFill();
853 args.fAntiAlias = false; 785 args.fAntiAlias = false;
854 args.fGammaCorrect = false; 786 args.fGammaCorrect = false;
855 pr->drawPath(args); 787 pr->drawPath(args);
856 } else { 788 } else {
857 GrPathRenderer::StencilPathArgs args; 789 GrPathRenderer::StencilPathArgs args;
858 args.fTarget = fDrawTarget; 790 args.fTarget = fDrawTarget;
859 args.fResourceProvider = this->getContext()->resourc eProvider(); 791 args.fResourceProvider = this->getContext()->resourc eProvider();
860 args.fPipelineBuilder = &pipelineBuilder; 792 args.fPipelineBuilder = &pipelineBuilder;
793 args.fClip = &clip;
861 args.fViewMatrix = &viewMatrix; 794 args.fViewMatrix = &viewMatrix;
862 args.fPath = &clipPath; 795 args.fPath = &clipPath;
863 pr->stencilPath(args); 796 pr->stencilPath(args);
864 } 797 }
865 } 798 }
866 } 799 }
867 } 800 }
868 801
869 // now we modify the clip bit by rendering either the clip 802 // now we modify the clip bit by rendering either the clip
870 // element directly or a bounding rect of the entire clip. 803 // element directly or a bounding rect of the entire clip.
871 fClipMode = kModifyClip_StencilClipMode; 804 fClipMode = kModifyClip_StencilClipMode;
872 for (GrUserStencilSettings const* const* pass = stencilPasses; *pass ; ++pass) { 805 for (GrUserStencilSettings const* const* pass = stencilPasses; *pass ; ++pass) {
873 pipelineBuilder.setUserStencil(*pass); 806 pipelineBuilder.setUserStencil(*pass);
874 807
875 if (drawDirectToClip) { 808 if (drawDirectToClip) {
876 if (Element::kRect_Type == element->getType()) { 809 if (Element::kRect_Type == element->getType()) {
877 draw_non_aa_rect(fDrawTarget, pipelineBuilder, GrColor_W HITE, viewMatrix, 810 draw_non_aa_rect(fDrawTarget, pipelineBuilder, clip, GrC olor_WHITE,
878 element->getRect()); 811 viewMatrix, element->getRect());
879 } else { 812 } else {
880 GrPathRenderer::DrawPathArgs args; 813 GrPathRenderer::DrawPathArgs args;
881 args.fTarget = fDrawTarget; 814 args.fTarget = fDrawTarget;
882 args.fResourceProvider = this->getContext()->resourcePro vider(); 815 args.fResourceProvider = this->getContext()->resourcePro vider();
883 args.fPipelineBuilder = &pipelineBuilder; 816 args.fPipelineBuilder = &pipelineBuilder;
817 args.fClip = &clip;
884 args.fColor = GrColor_WHITE; 818 args.fColor = GrColor_WHITE;
885 args.fViewMatrix = &viewMatrix; 819 args.fViewMatrix = &viewMatrix;
886 args.fPath = &clipPath; 820 args.fPath = &clipPath;
887 args.fStyle = &GrStyle::SimpleFill(); 821 args.fStyle = &GrStyle::SimpleFill();
888 args.fAntiAlias = false; 822 args.fAntiAlias = false;
889 args.fGammaCorrect = false; 823 args.fGammaCorrect = false;
890 pr->drawPath(args); 824 pr->drawPath(args);
891 } 825 }
892 } else { 826 } else {
893 // The view matrix is setup to do clip space -> stencil spac e translation, so 827 // The view matrix is setup to do clip space -> stencil spac e translation, so
894 // draw rect in clip space. 828 // draw rect in clip space.
895 draw_non_aa_rect(fDrawTarget, pipelineBuilder, GrColor_WHITE , viewMatrix, 829 draw_non_aa_rect(fDrawTarget, pipelineBuilder, clip, GrColor _WHITE, viewMatrix,
896 SkRect::Make(clipSpaceIBounds)); 830 SkRect::Make(clipSpaceIBounds));
897 } 831 }
898 } 832 }
899 } 833 }
900 } 834 }
901 fClipMode = kRespectClip_StencilClipMode; 835 fClipMode = kRespectClip_StencilClipMode;
902 return true; 836 return true;
903 } 837 }
904 838
905 //////////////////////////////////////////////////////////////////////////////// 839 ////////////////////////////////////////////////////////////////////////////////
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 GrTexture* result = context->resourceProvider()->createApproxTexture(desc, 0 ); 906 GrTexture* result = context->resourceProvider()->createApproxTexture(desc, 0 );
973 if (!result) { 907 if (!result) {
974 return nullptr; 908 return nullptr;
975 } 909 }
976 result->resourcePriv().setUniqueKey(key); 910 result->resourcePriv().setUniqueKey(key);
977 911
978 helper.toTexture(result); 912 helper.toTexture(result);
979 913
980 return result; 914 return result;
981 } 915 }
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawContext.cpp » ('j') | src/gpu/GrDrawTarget.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698