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

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

Issue 509153002: Initial change to create GeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: last warning Created 6 years, 3 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 | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrBitmapTextContext.cpp » ('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 "gl/builders/GrGLProgramBuilder.h" 8 #include "gl/builders/GrGLProgramBuilder.h"
9 #include "GrAARectRenderer.h" 9 #include "GrAARectRenderer.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 if (!geo.succeeded()) { 641 if (!geo.succeeded()) {
642 GrPrintf("Failed to get space for vertices!\n"); 642 GrPrintf("Failed to get space for vertices!\n");
643 return; 643 return;
644 } 644 }
645 645
646 RectVertex* verts = reinterpret_cast<RectVertex*>(geo.vertices()); 646 RectVertex* verts = reinterpret_cast<RectVertex*>(geo.vertices());
647 647
648 GrEffect* effect = GrRectEffect::Create(); 648 GrEffect* effect = GrRectEffect::Create();
649 static const int kRectAttrIndex = 1; 649 static const int kRectAttrIndex = 1;
650 static const int kWidthIndex = 2; 650 static const int kWidthIndex = 2;
651 drawState->addCoverageEffect(effect, kRectAttrIndex, kWidthIndex)->unref(); 651 drawState->setGeometryProcessor(effect, kRectAttrIndex, kWidthIndex)->unref( );
652 652
653 for (int i = 0; i < 4; ++i) { 653 for (int i = 0; i < 4; ++i) {
654 verts[i].fCenter = center; 654 verts[i].fCenter = center;
655 verts[i].fDir = dir; 655 verts[i].fDir = dir;
656 verts[i].fWidthHeight.fX = newWidth; 656 verts[i].fWidthHeight.fX = newWidth;
657 verts[i].fWidthHeight.fY = newHeight; 657 verts[i].fWidthHeight.fY = newHeight;
658 } 658 }
659 659
660 SkRect devRect; 660 SkRect devRect;
661 combinedMatrix.mapRect(&devRect, rect); 661 combinedMatrix.mapRect(&devRect, rect);
(...skipping 28 matching lines...) Expand all
690 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0); 690 GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
691 if (!geo.succeeded()) { 691 if (!geo.succeeded()) {
692 GrPrintf("Failed to get space for vertices!\n"); 692 GrPrintf("Failed to get space for vertices!\n");
693 return; 693 return;
694 } 694 }
695 695
696 AARectVertex* verts = reinterpret_cast<AARectVertex*>(geo.vertices()); 696 AARectVertex* verts = reinterpret_cast<AARectVertex*>(geo.vertices());
697 697
698 GrEffect* effect = GrAlignedRectEffect::Create(); 698 GrEffect* effect = GrAlignedRectEffect::Create();
699 static const int kOffsetIndex = 1; 699 static const int kOffsetIndex = 1;
700 drawState->addCoverageEffect(effect, kOffsetIndex)->unref(); 700 drawState->setGeometryProcessor(effect, kOffsetIndex)->unref();
701 701
702 SkRect devRect; 702 SkRect devRect;
703 combinedMatrix.mapRect(&devRect, rect); 703 combinedMatrix.mapRect(&devRect, rect);
704 704
705 SkRect devBounds = { 705 SkRect devBounds = {
706 devRect.fLeft - SK_ScalarHalf, 706 devRect.fLeft - SK_ScalarHalf,
707 devRect.fTop - SK_ScalarHalf, 707 devRect.fTop - SK_ScalarHalf,
708 devRect.fRight + SK_ScalarHalf, 708 devRect.fRight + SK_ScalarHalf,
709 devRect.fBottom + SK_ScalarHalf 709 devRect.fBottom + SK_ScalarHalf
710 }; 710 };
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 // can't call mapRect for devInside since it calls sort 949 // can't call mapRect for devInside since it calls sort
950 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ; 950 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ;
951 951
952 if (devInside.isEmpty()) { 952 if (devInside.isEmpty()) {
953 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); 953 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside);
954 return; 954 return;
955 } 955 }
956 956
957 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns ide, true); 957 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns ide, true);
958 } 958 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698