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

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

Issue 2244223004: Make GrReducedClip's gen ID only apply to the element list (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more improved testing Created 4 years, 4 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 | « no previous file | src/gpu/GrReducedClip.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 2016 Google Inc. 2 * Copyright 2016 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 "GrClipStackClip.h" 8 #include "GrClipStackClip.h"
9 9
10 #include "GrDrawingManager.h" 10 #include "GrDrawingManager.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 builder[0] = clipGenID; 419 builder[0] = clipGenID;
420 builder[1] = SkToU16(bounds.fLeft) | (SkToU16(bounds.fRight) << 16); 420 builder[1] = SkToU16(bounds.fLeft) | (SkToU16(bounds.fRight) << 16);
421 builder[2] = SkToU16(bounds.fTop) | (SkToU16(bounds.fBottom) << 16); 421 builder[2] = SkToU16(bounds.fTop) | (SkToU16(bounds.fBottom) << 16);
422 } 422 }
423 423
424 sk_sp<GrTexture> GrClipStackClip::CreateAlphaClipMask(GrContext* context, 424 sk_sp<GrTexture> GrClipStackClip::CreateAlphaClipMask(GrContext* context,
425 const GrReducedClip& reduc edClip, 425 const GrReducedClip& reduc edClip,
426 const SkVector& clipToMask Offset) { 426 const SkVector& clipToMask Offset) {
427 GrResourceProvider* resourceProvider = context->resourceProvider(); 427 GrResourceProvider* resourceProvider = context->resourceProvider();
428 GrUniqueKey key; 428 GrUniqueKey key;
429 GetClipMaskKey(reducedClip.genID(), reducedClip.ibounds(), &key); 429 GetClipMaskKey(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
430 if (GrTexture* texture = resourceProvider->findAndRefTextureByUniqueKey(key) ) { 430 if (GrTexture* texture = resourceProvider->findAndRefTextureByUniqueKey(key) ) {
431 return sk_sp<GrTexture>(texture); 431 return sk_sp<GrTexture>(texture);
432 } 432 }
433 433
434 // There's no texture in the cache. Let's try to allocate it then. 434 // There's no texture in the cache. Let's try to allocate it then.
435 GrPixelConfig config = kRGBA_8888_GrPixelConfig; 435 GrPixelConfig config = kRGBA_8888_GrPixelConfig;
436 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { 436 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
437 config = kAlpha_8_GrPixelConfig; 437 config = kAlpha_8_GrPixelConfig;
438 } 438 }
439 439
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 const SkIPoint& clipSpaceToStencilOf fset) { 527 const SkIPoint& clipSpaceToStencilOf fset) {
528 SkASSERT(drawContext); 528 SkASSERT(drawContext);
529 529
530 GrStencilAttachment* stencilAttachment = context->resourceProvider()->attach StencilAttachment( 530 GrStencilAttachment* stencilAttachment = context->resourceProvider()->attach StencilAttachment(
531 drawContext->accessRenderTar get()); 531 drawContext->accessRenderTar get());
532 if (nullptr == stencilAttachment) { 532 if (nullptr == stencilAttachment) {
533 return false; 533 return false;
534 } 534 }
535 535
536 // TODO: these need to be swapped over to using a StencilAttachmentProxy 536 // TODO: these need to be swapped over to using a StencilAttachmentProxy
537 if (stencilAttachment->mustRenderClip(reducedClip.genID(), reducedClip.iboun ds(), 537 if (stencilAttachment->mustRenderClip(reducedClip.elementsGenID(), reducedCl ip.ibounds(),
538 clipSpaceToStencilOffset)) { 538 clipSpaceToStencilOffset)) {
539 stencilAttachment->setLastClip(reducedClip.genID(), reducedClip.ibounds( ), 539 stencilAttachment->setLastClip(reducedClip.elementsGenID(), reducedClip. ibounds(),
540 clipSpaceToStencilOffset); 540 clipSpaceToStencilOffset);
541 // Set the matrix so that rendered clip elements are transformed from cl ip to stencil space. 541 // Set the matrix so that rendered clip elements are transformed from cl ip to stencil space.
542 SkVector translate = { 542 SkVector translate = {
543 SkIntToScalar(clipSpaceToStencilOffset.fX), 543 SkIntToScalar(clipSpaceToStencilOffset.fX),
544 SkIntToScalar(clipSpaceToStencilOffset.fY) 544 SkIntToScalar(clipSpaceToStencilOffset.fY)
545 }; 545 };
546 SkMatrix viewMatrix; 546 SkMatrix viewMatrix;
547 viewMatrix.setTranslate(translate); 547 viewMatrix.setTranslate(translate);
548 548
549 // We set the current clip to the bounds so that our recursive draws are scissored to them. 549 // We set the current clip to the bounds so that our recursive draws are scissored to them.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 } 694 }
695 } 695 }
696 return true; 696 return true;
697 } 697 }
698 698
699 //////////////////////////////////////////////////////////////////////////////// 699 ////////////////////////////////////////////////////////////////////////////////
700 sk_sp<GrTexture> GrClipStackClip::CreateSoftwareClipMask(GrTextureProvider* texP rovider, 700 sk_sp<GrTexture> GrClipStackClip::CreateSoftwareClipMask(GrTextureProvider* texP rovider,
701 const GrReducedClip& re ducedClip, 701 const GrReducedClip& re ducedClip,
702 const SkVector& clipToM askOffset) { 702 const SkVector& clipToM askOffset) {
703 GrUniqueKey key; 703 GrUniqueKey key;
704 GetClipMaskKey(reducedClip.genID(), reducedClip.ibounds(), &key); 704 GetClipMaskKey(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
705 if (GrTexture* texture = texProvider->findAndRefTextureByUniqueKey(key)) { 705 if (GrTexture* texture = texProvider->findAndRefTextureByUniqueKey(key)) {
706 return sk_sp<GrTexture>(texture); 706 return sk_sp<GrTexture>(texture);
707 } 707 }
708 708
709 // The mask texture may be larger than necessary. We round out the clip spac e bounds and pin 709 // The mask texture may be larger than necessary. We round out the clip spac e bounds and pin
710 // the top left corner of the resulting rect to the top left of the texture. 710 // the top left corner of the resulting rect to the top left of the texture.
711 SkIRect maskSpaceIBounds = SkIRect::MakeWH(reducedClip.width(), reducedClip. height()); 711 SkIRect maskSpaceIBounds = SkIRect::MakeWH(reducedClip.width(), reducedClip. height());
712 712
713 GrSWMaskHelper helper(texProvider); 713 GrSWMaskHelper helper(texProvider);
714 714
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); 763 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc));
764 if (!result) { 764 if (!result) {
765 return nullptr; 765 return nullptr;
766 } 766 }
767 result->resourcePriv().setUniqueKey(key); 767 result->resourcePriv().setUniqueKey(key);
768 768
769 helper.toTexture(result.get()); 769 helper.toTexture(result.get());
770 770
771 return result; 771 return result;
772 } 772 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrReducedClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698