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

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

Issue 311183002: Push dash checks into GrContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Merge issues Created 6 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
« no previous file with comments | « src/gpu/GrAARectRenderer.h ('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 "GrAARectRenderer.h" 8 #include "GrAARectRenderer.h"
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 #include "gl/GrGLEffect.h" 10 #include "gl/GrGLEffect.h"
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 target->setIndexSourceToBuffer(gpu->getContext()->getQuadIndexBuffer()); 719 target->setIndexSourceToBuffer(gpu->getContext()->getQuadIndexBuffer());
720 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 4, 6); 720 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 4, 6);
721 target->resetIndexSource(); 721 target->resetIndexSource();
722 } 722 }
723 723
724 void GrAARectRenderer::strokeAARect(GrGpu* gpu, 724 void GrAARectRenderer::strokeAARect(GrGpu* gpu,
725 GrDrawTarget* target, 725 GrDrawTarget* target,
726 const SkRect& rect, 726 const SkRect& rect,
727 const SkMatrix& combinedMatrix, 727 const SkMatrix& combinedMatrix,
728 const SkRect& devRect, 728 const SkRect& devRect,
729 const SkStrokeRec* stroke, 729 const SkStrokeRec& stroke,
730 bool useVertexCoverage) { 730 bool useVertexCoverage) {
731 SkVector devStrokeSize; 731 SkVector devStrokeSize;
732 SkScalar width = stroke->getWidth(); 732 SkScalar width = stroke.getWidth();
733 if (width > 0) { 733 if (width > 0) {
734 devStrokeSize.set(width, width); 734 devStrokeSize.set(width, width);
735 combinedMatrix.mapVectors(&devStrokeSize, 1); 735 combinedMatrix.mapVectors(&devStrokeSize, 1);
736 devStrokeSize.setAbs(devStrokeSize); 736 devStrokeSize.setAbs(devStrokeSize);
737 } else { 737 } else {
738 devStrokeSize.set(SK_Scalar1, SK_Scalar1); 738 devStrokeSize.set(SK_Scalar1, SK_Scalar1);
739 } 739 }
740 740
741 const SkScalar dx = devStrokeSize.fX; 741 const SkScalar dx = devStrokeSize.fX;
742 const SkScalar dy = devStrokeSize.fY; 742 const SkScalar dy = devStrokeSize.fY;
(...skipping 13 matching lines...) Expand all
756 SkScalar w = devRect.width() - dx; 756 SkScalar w = devRect.width() - dx;
757 SkScalar h = devRect.height() - dy; 757 SkScalar h = devRect.height() - dy;
758 spare = SkTMin(w, h); 758 spare = SkTMin(w, h);
759 } 759 }
760 760
761 SkRect devOutside(devRect); 761 SkRect devOutside(devRect);
762 devOutside.outset(rx, ry); 762 devOutside.outset(rx, ry);
763 763
764 bool miterStroke = true; 764 bool miterStroke = true;
765 // small miter limit means right angles show bevel... 765 // small miter limit means right angles show bevel...
766 if (stroke->getJoin() != SkPaint::kMiter_Join || stroke->getMiter() < SK_Sca larSqrt2) { 766 if (stroke.getJoin() != SkPaint::kMiter_Join || stroke.getMiter() < SK_Scala rSqrt2) {
767 miterStroke = false; 767 miterStroke = false;
768 } 768 }
769 769
770 if (spare <= 0 && miterStroke) { 770 if (spare <= 0 && miterStroke) {
771 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), 771 this->fillAARect(gpu, target, devOutside, SkMatrix::I(),
772 devOutside, useVertexCoverage); 772 devOutside, useVertexCoverage);
773 return; 773 return;
774 } 774 }
775 775
776 SkRect devInside(devRect); 776 SkRect devInside(devRect);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ; 923 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ;
924 924
925 if (devInside.isEmpty()) { 925 if (devInside.isEmpty()) {
926 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use VertexCoverage); 926 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use VertexCoverage);
927 return; 927 return;
928 } 928 }
929 929
930 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, 930 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist,
931 devInside, useVertexCoverage, true); 931 devInside, useVertexCoverage, true);
932 } 932 }
OLDNEW
« no previous file with comments | « src/gpu/GrAARectRenderer.h ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698