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 "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 const SkPath& path, | 1021 const SkPath& path, |
1022 const SkStrokeRec& stroke, | 1022 const SkStrokeRec& stroke, |
1023 bool) { | 1023 bool) { |
1024 SkScalar hairlineCoverage; | 1024 SkScalar hairlineCoverage; |
1025 uint8_t newCoverage = 0xff; | 1025 uint8_t newCoverage = 0xff; |
1026 if (IsStrokeHairlineOrEquivalent(stroke, viewMatrix, &hairlineCoverage)) { | 1026 if (IsStrokeHairlineOrEquivalent(stroke, viewMatrix, &hairlineCoverage)) { |
1027 newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff); | 1027 newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff); |
1028 } | 1028 } |
1029 | 1029 |
1030 SkIRect devClipBounds; | 1030 SkIRect devClipBounds; |
1031 target->getClip()->getConservativeBounds(pipelineBuilder->getRenderTarget(),
&devClipBounds); | 1031 pipelineBuilder->clip().getConservativeBounds(pipelineBuilder->getRenderTarg
et(), |
| 1032 &devClipBounds); |
1032 | 1033 |
1033 // This outset was determined experimentally by running skps and gms. It pr
obably could be a | 1034 // This outset was determined experimentally by running skps and gms. It pr
obably could be a |
1034 // bit tighter | 1035 // bit tighter |
1035 SkRect devRect = path.getBounds(); | 1036 SkRect devRect = path.getBounds(); |
1036 viewMatrix.mapRect(&devRect); | 1037 viewMatrix.mapRect(&devRect); |
1037 devRect.outset(2, 2); | 1038 devRect.outset(2, 2); |
1038 | 1039 |
1039 AAHairlineBatch::Geometry geometry; | 1040 AAHairlineBatch::Geometry geometry; |
1040 geometry.fColor = color; | 1041 geometry.fColor = color; |
1041 geometry.fCoverage = newCoverage; | 1042 geometry.fCoverage = newCoverage; |
1042 geometry.fViewMatrix = viewMatrix; | 1043 geometry.fViewMatrix = viewMatrix; |
1043 geometry.fPath = path; | 1044 geometry.fPath = path; |
1044 SkDEBUGCODE(geometry.fDevBounds = devRect;) | 1045 SkDEBUGCODE(geometry.fDevBounds = devRect;) |
1045 geometry.fDevClipBounds = devClipBounds; | 1046 geometry.fDevClipBounds = devClipBounds; |
1046 | 1047 |
1047 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf
fer, | 1048 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf
fer, |
1048 fQuadsIndexBuffer)); | 1049 fQuadsIndexBuffer)); |
1049 target->drawBatch(pipelineBuilder, batch, &devRect); | 1050 target->drawBatch(pipelineBuilder, batch, &devRect); |
1050 | 1051 |
1051 return true; | 1052 return true; |
1052 } | 1053 } |
OLD | NEW |