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

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

Issue 16952006: Replace fixed-size array of effect stages in GrDrawState with two appendable arrays, one for color,… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix comments Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrClipMaskManager.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 "GrAARectRenderer.h" 8 #include "GrAARectRenderer.h"
9 #include "GrRefCnt.h" 9 #include "GrRefCnt.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 GrAssert(sizeof(RectVertex) == drawState->getVertexSize()); 535 GrAssert(sizeof(RectVertex) == drawState->getVertexSize());
536 536
537 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0); 537 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
538 if (!geo.succeeded()) { 538 if (!geo.succeeded()) {
539 GrPrintf("Failed to get space for vertices!\n"); 539 GrPrintf("Failed to get space for vertices!\n");
540 return; 540 return;
541 } 541 }
542 542
543 RectVertex* verts = reinterpret_cast<RectVertex*>(geo.vertices()); 543 RectVertex* verts = reinterpret_cast<RectVertex*>(geo.vertices());
544 544
545 enum {
546 // the edge effects share this stage with glyph rendering
547 // (kGlyphMaskStage in GrTextContext) && SW path rendering
548 // (kPathMaskStage in GrSWMaskHelper)
549 kEdgeEffectStage = GrPaint::kTotalStages,
550 };
551
552 GrEffectRef* effect = GrRectEffect::Create(); 545 GrEffectRef* effect = GrRectEffect::Create();
553 static const int kRectAttrIndex = 1; 546 static const int kRectAttrIndex = 1;
554 static const int kWidthIndex = 2; 547 static const int kWidthIndex = 2;
555 drawState->setEffect(kEdgeEffectStage, effect, kRectAttrIndex, kWidthIndex)- >unref(); 548 drawState->addCoverageEffect(effect, kRectAttrIndex, kWidthIndex)->unref();
556 549
557 for (int i = 0; i < 4; ++i) { 550 for (int i = 0; i < 4; ++i) {
558 verts[i].fCenter = center; 551 verts[i].fCenter = center;
559 verts[i].fDir = dir; 552 verts[i].fDir = dir;
560 verts[i].fWidthHeight.fX = newWidth; 553 verts[i].fWidthHeight.fX = newWidth;
561 verts[i].fWidthHeight.fY = newHeight; 554 verts[i].fWidthHeight.fY = newHeight;
562 } 555 }
563 556
564 SkRect devRect; 557 SkRect devRect;
565 combinedMatrix.mapRect(&devRect, rect); 558 combinedMatrix.mapRect(&devRect, rect);
(...skipping 26 matching lines...) Expand all
592 GrAssert(sizeof(AARectVertex) == drawState->getVertexSize()); 585 GrAssert(sizeof(AARectVertex) == drawState->getVertexSize());
593 586
594 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0); 587 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
595 if (!geo.succeeded()) { 588 if (!geo.succeeded()) {
596 GrPrintf("Failed to get space for vertices!\n"); 589 GrPrintf("Failed to get space for vertices!\n");
597 return; 590 return;
598 } 591 }
599 592
600 AARectVertex* verts = reinterpret_cast<AARectVertex*>(geo.vertices()); 593 AARectVertex* verts = reinterpret_cast<AARectVertex*>(geo.vertices());
601 594
602 enum {
603 // the edge effects share this stage with glyph rendering
604 // (kGlyphMaskStage in GrTextContext) && SW path rendering
605 // (kPathMaskStage in GrSWMaskHelper)
606 kEdgeEffectStage = GrPaint::kTotalStages,
607 };
608
609 GrEffectRef* effect = GrAlignedRectEffect::Create(); 595 GrEffectRef* effect = GrAlignedRectEffect::Create();
610 static const int kOffsetIndex = 1; 596 static const int kOffsetIndex = 1;
611 drawState->setEffect(kEdgeEffectStage, effect, kOffsetIndex)->unref(); 597 drawState->addCoverageEffect(effect, kOffsetIndex)->unref();
612 598
613 SkRect devRect; 599 SkRect devRect;
614 combinedMatrix.mapRect(&devRect, rect); 600 combinedMatrix.mapRect(&devRect, rect);
615 601
616 SkRect devBounds = { 602 SkRect devBounds = {
617 devRect.fLeft - SK_ScalarHalf, 603 devRect.fLeft - SK_ScalarHalf,
618 devRect.fTop - SK_ScalarHalf, 604 devRect.fTop - SK_ScalarHalf,
619 devRect.fRight + SK_ScalarHalf, 605 devRect.fRight + SK_ScalarHalf,
620 devRect.fBottom + SK_ScalarHalf 606 devRect.fBottom + SK_ScalarHalf
621 }; 607 };
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 // can't call mapRect for devInside since it calls sort 764 // can't call mapRect for devInside since it calls sort
779 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ; 765 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ;
780 766
781 if (devInside.isEmpty()) { 767 if (devInside.isEmpty()) {
782 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use VertexCoverage); 768 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use VertexCoverage);
783 return; 769 return;
784 } 770 }
785 771
786 this->geometryStrokeAARect(gpu, target, devOutside, devInside, useVertexCove rage); 772 this->geometryStrokeAARect(gpu, target, devOutside, devInside, useVertexCove rage);
787 } 773 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrClipMaskManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698