Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrAADistanceFieldPathRenderer.h" | 9 #include "GrAADistanceFieldPathRenderer.h" |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 const SkRect& bounds = args.fPath->getBounds(); | 102 const SkRect& bounds = args.fPath->getBounds(); |
| 103 SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height()); | 103 SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height()); |
| 104 // Approximate stroked size by adding the maximum of the stroke width or 2x the miter limit | 104 // Approximate stroked size by adding the maximum of the stroke width or 2x the miter limit |
| 105 if (!args.fStroke->isFillStyle()) { | 105 if (!args.fStroke->isFillStyle()) { |
| 106 SkScalar extraWidth = args.fStroke->getWidth(); | 106 SkScalar extraWidth = args.fStroke->getWidth(); |
| 107 if (SkPaint::kMiter_Join == args.fStroke->getJoin()) { | 107 if (SkPaint::kMiter_Join == args.fStroke->getJoin()) { |
| 108 extraWidth = SkTMax(extraWidth, 2.0f*args.fStroke->getMiter()); | 108 extraWidth = SkTMax(extraWidth, 2.0f*args.fStroke->getMiter()); |
| 109 } | 109 } |
| 110 maxDim += extraWidth; | 110 maxDim += extraWidth; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // We don't currently apply the dash or factor it into the DF key. | |
| 114 if (args.fStroke->isDashed()) { | |
|
egdaniel
2016/03/11 01:00:52
any reason not to move this check up earlier to av
jvanverth1
2016/03/11 13:49:40
The first conditional block seems like a good plac
| |
| 115 return false; | |
| 116 } | |
| 117 | |
| 113 return maxDim <= kMediumMIP && maxDim * maxScale <= 2.0f*kLargeMIP; | 118 return maxDim <= kMediumMIP && maxDim * maxScale <= 2.0f*kLargeMIP; |
| 114 } | 119 } |
| 115 | 120 |
| 116 //////////////////////////////////////////////////////////////////////////////// | 121 //////////////////////////////////////////////////////////////////////////////// |
| 117 | 122 |
| 118 // padding around path bounds to allow for antialiased pixels | 123 // padding around path bounds to allow for antialiased pixels |
| 119 static const SkScalar kAntiAliasPad = 1.0f; | 124 static const SkScalar kAntiAliasPad = 1.0f; |
| 120 | 125 |
| 121 class AADistanceFieldPathBatch : public GrVertexBatch { | 126 class AADistanceFieldPathBatch : public GrVertexBatch { |
| 122 public: | 127 public: |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 geometry.fAntiAlias = random->nextBool(); | 650 geometry.fAntiAlias = random->nextBool(); |
| 646 geometry.fGenID = random->nextU(); | 651 geometry.fGenID = random->nextU(); |
| 647 | 652 |
| 648 return AADistanceFieldPathBatch::Create(geometry, viewMatrix, | 653 return AADistanceFieldPathBatch::Create(geometry, viewMatrix, |
| 649 gTestStruct.fAtlas, | 654 gTestStruct.fAtlas, |
| 650 &gTestStruct.fPathCache, | 655 &gTestStruct.fPathCache, |
| 651 &gTestStruct.fPathList); | 656 &gTestStruct.fPathList); |
| 652 } | 657 } |
| 653 | 658 |
| 654 #endif | 659 #endif |
| OLD | NEW |