| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2016 Google Inc. | 2  * Copyright 2016 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 "Test.h" | 8 #include "Test.h" | 
| 9 | 9 | 
| 10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU | 
| 11 #include "GrContext.h" | 11 #include "GrContext.h" | 
| 12 #include "GrTest.h" | 12 #include "GrTest.h" | 
| 13 #include "batches/GrAADistanceFieldPathRenderer.h" | 13 #include "batches/GrAADistanceFieldPathRenderer.h" | 
| 14 #include "SkPath.h" | 14 #include "SkPath.h" | 
| 15 | 15 | 
| 16 // This test case including path coords and matrix taken from crbug.com/627443. | 16 // This test case including path coords and matrix taken from crbug.com/627443. | 
| 17 // Because of inaccuracies in large floating point values this causes the | 17 // Because of inaccuracies in large floating point values this causes the | 
| 18 // the path renderer to attempt to add a path DF to its atlas that is larger | 18 // the path renderer to attempt to add a path DF to its atlas that is larger | 
| 19 // than the plot size which used to crash rather than fail gracefully. | 19 // than the plot size which used to crash rather than fail gracefully. | 
| 20 static void test_far_from_origin(GrDrawContext* drawContext, GrPathRenderer* pr, | 20 static void test_far_from_origin(GrDrawContext* drawContext, GrPathRenderer* pr, | 
| 21                                  GrResourceProvider* rp) { | 21                                  GrResourceProvider* rp) { | 
| 22     SkPath path; | 22     SkPath path; | 
| 23     path.lineTo(49.0255089839f, 0.473541f); | 23     path.lineTo(49.0255089839f, 0.473541f); | 
|  | 24     // This extra line wasn't in the original bug but was added to fake out GrSh
    ape's special | 
|  | 25     // handling of single line segments. | 
|  | 26     path.rLineTo(0.015f, 0.015f); | 
| 24     static constexpr SkScalar mvals[] = {14.0348252854f, 2.13026182736f, | 27     static constexpr SkScalar mvals[] = {14.0348252854f, 2.13026182736f, | 
| 25                                          13.6122547187f, 118.309922702f, | 28                                          13.6122547187f, 118.309922702f, | 
| 26                                          1912337682.09f, 2105391889.87f}; | 29                                          1912337682.09f, 2105391889.87f}; | 
| 27     SkMatrix matrix; | 30     SkMatrix matrix; | 
| 28     matrix.setAffine(mvals); | 31     matrix.setAffine(mvals); | 
| 29     SkMatrix inverse; | 32     SkMatrix inverse; | 
| 30     SkAssertResult(matrix.invert(&inverse)); | 33     SkAssertResult(matrix.invert(&inverse)); | 
| 31     path.transform(inverse); | 34     path.transform(inverse); | 
| 32 | 35 | 
| 33     SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); | 36     SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 71 | 74 | 
| 72     GrAADistanceFieldPathRenderer dfpr; | 75     GrAADistanceFieldPathRenderer dfpr; | 
| 73     GrTestTarget tt; | 76     GrTestTarget tt; | 
| 74     ctxInfo.grContext()->getTestTarget(&tt, drawContext); | 77     ctxInfo.grContext()->getTestTarget(&tt, drawContext); | 
| 75     GrResourceProvider* rp = tt.resourceProvider(); | 78     GrResourceProvider* rp = tt.resourceProvider(); | 
| 76 | 79 | 
| 77     test_far_from_origin(drawContext.get(), &dfpr, rp); | 80     test_far_from_origin(drawContext.get(), &dfpr, rp); | 
| 78     ctxInfo.grContext()->flush(); | 81     ctxInfo.grContext()->flush(); | 
| 79 } | 82 } | 
| 80 #endif | 83 #endif | 
| OLD | NEW | 
|---|