OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" | 8 #include "GrAAHairLinePathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 *vert += kLineSegNumVertices; | 615 *vert += kLineSegNumVertices; |
616 } | 616 } |
617 | 617 |
618 /////////////////////////////////////////////////////////////////////////////// | 618 /////////////////////////////////////////////////////////////////////////////// |
619 | 619 |
620 bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const
{ | 620 bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const
{ |
621 if (!args.fAntiAlias) { | 621 if (!args.fAntiAlias) { |
622 return false; | 622 return false; |
623 } | 623 } |
624 | 624 |
625 if (!IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, NULL)) { | 625 if (!IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, nullptr)
) { |
626 return false; | 626 return false; |
627 } | 627 } |
628 | 628 |
629 if (SkPath::kLine_SegmentMask == args.fPath->getSegmentMasks() || | 629 if (SkPath::kLine_SegmentMask == args.fPath->getSegmentMasks() || |
630 args.fShaderCaps->shaderDerivativeSupport()) { | 630 args.fShaderCaps->shaderDerivativeSupport()) { |
631 return true; | 631 return true; |
632 } | 632 } |
633 return false; | 633 return false; |
634 } | 634 } |
635 | 635 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 // Setup the viewmatrix and localmatrix for the GrGeometryProcessor. | 791 // Setup the viewmatrix and localmatrix for the GrGeometryProcessor. |
792 SkMatrix invert; | 792 SkMatrix invert; |
793 if (!this->viewMatrix().invert(&invert)) { | 793 if (!this->viewMatrix().invert(&invert)) { |
794 return; | 794 return; |
795 } | 795 } |
796 | 796 |
797 // we will transform to identity space if the viewmatrix does not have persp
ective | 797 // we will transform to identity space if the viewmatrix does not have persp
ective |
798 bool hasPerspective = this->viewMatrix().hasPerspective(); | 798 bool hasPerspective = this->viewMatrix().hasPerspective(); |
799 const SkMatrix* geometryProcessorViewM = &SkMatrix::I(); | 799 const SkMatrix* geometryProcessorViewM = &SkMatrix::I(); |
800 const SkMatrix* geometryProcessorLocalM = &invert; | 800 const SkMatrix* geometryProcessorLocalM = &invert; |
801 const SkMatrix* toDevice = NULL; | 801 const SkMatrix* toDevice = nullptr; |
802 const SkMatrix* toSrc = NULL; | 802 const SkMatrix* toSrc = nullptr; |
803 if (hasPerspective) { | 803 if (hasPerspective) { |
804 geometryProcessorViewM = &this->viewMatrix(); | 804 geometryProcessorViewM = &this->viewMatrix(); |
805 geometryProcessorLocalM = &SkMatrix::I(); | 805 geometryProcessorLocalM = &SkMatrix::I(); |
806 toDevice = &this->viewMatrix(); | 806 toDevice = &this->viewMatrix(); |
807 toSrc = &invert; | 807 toSrc = &invert; |
808 } | 808 } |
809 | 809 |
810 SkAutoTUnref<const GrGeometryProcessor> lineGP; | 810 SkAutoTUnref<const GrGeometryProcessor> lineGP; |
811 { | 811 { |
812 using namespace GrDefaultGeoProcFactory; | 812 using namespace GrDefaultGeoProcFactory; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 GrColor color = GrRandomColor(random); | 989 GrColor color = GrRandomColor(random); |
990 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 990 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
991 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 991 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
992 SkPath path = GrTest::TestPath(random); | 992 SkPath path = GrTest::TestPath(random); |
993 SkIRect devClipBounds; | 993 SkIRect devClipBounds; |
994 devClipBounds.setEmpty(); | 994 devClipBounds.setEmpty(); |
995 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 995 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
996 } | 996 } |
997 | 997 |
998 #endif | 998 #endif |
OLD | NEW |