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

Side by Side Diff: src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp

Issue 1138263002: Revert of stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/effects/SkPerlinNoiseShader.cpp ('k') | src/gpu/GrAAConvexPathRenderer.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 /* 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 "SkTwoPointConicalGradient_gpu.h" 9 #include "SkTwoPointConicalGradient_gpu.h"
10 10
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // If the focal point is touching the edge of the circle it will 350 // If the focal point is touching the edge of the circle it will
351 // cause a degenerate case that must be handled separately 351 // cause a degenerate case that must be handled separately
352 // kEdgeErrorTol = 5 * kErrorTol was picked after manual testing the 352 // kEdgeErrorTol = 5 * kErrorTol was picked after manual testing the
353 // stability trade off versus the linear approx used in the Edge Shader 353 // stability trade off versus the linear approx used in the Edge Shader
354 if (SkScalarAbs(1.f - (*focalX)) < kEdgeErrorTol) { 354 if (SkScalarAbs(1.f - (*focalX)) < kEdgeErrorTol) {
355 return kEdge_ConicalType; 355 return kEdge_ConicalType;
356 } 356 }
357 357
358 // Scale factor 1 / (1 - focalX * focalX) 358 // Scale factor 1 / (1 - focalX * focalX)
359 SkScalar oneMinusF2 = 1.f - SkScalarMul(*focalX, *focalX); 359 SkScalar oneMinusF2 = 1.f - SkScalarMul(*focalX, *focalX);
360 SkScalar s = SkScalarInvert(oneMinusF2); 360 SkScalar s = SkScalarDiv(1.f, oneMinusF2);
361 361
362 362
363 if (s >= 0.f) { 363 if (s >= 0.f) {
364 conicalType = kInside_ConicalType; 364 conicalType = kInside_ConicalType;
365 matrix.postScale(s, s * SkScalarSqrt(oneMinusF2)); 365 matrix.postScale(s, s * SkScalarSqrt(oneMinusF2));
366 } else { 366 } else {
367 conicalType = kOutside_ConicalType; 367 conicalType = kOutside_ConicalType;
368 matrix.postScale(s, s); 368 matrix.postScale(s, s);
369 } 369 }
370 370
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 } 1108 }
1109 1109
1110 CircleOutside2PtConicalEffect(GrContext* ctx, 1110 CircleOutside2PtConicalEffect(GrContext* ctx,
1111 const SkTwoPointConicalGradient& shader, 1111 const SkTwoPointConicalGradient& shader,
1112 const SkMatrix& matrix, 1112 const SkMatrix& matrix,
1113 SkShader::TileMode tm, 1113 SkShader::TileMode tm,
1114 const CircleConicalInfo& info) 1114 const CircleConicalInfo& info)
1115 : INHERITED(ctx, shader, matrix, tm), fInfo(info) { 1115 : INHERITED(ctx, shader, matrix, tm), fInfo(info) {
1116 this->initClassID<CircleOutside2PtConicalEffect>(); 1116 this->initClassID<CircleOutside2PtConicalEffect>();
1117 if (shader.getStartRadius() != shader.getEndRadius()) { 1117 if (shader.getStartRadius() != shader.getEndRadius()) {
1118 fTLimit = shader.getStartRadius() / (shader.getStartRadius() - shade r.getEndRadius()); 1118 fTLimit = SkScalarDiv(shader.getStartRadius(),
1119 (shader.getStartRadius() - shader.getEndRadius ()));
1119 } else { 1120 } else {
1120 fTLimit = SK_ScalarMin; 1121 fTLimit = SK_ScalarMin;
1121 } 1122 }
1122 1123
1123 fIsFlipped = shader.isFlippedGrad(); 1124 fIsFlipped = shader.isFlippedGrad();
1124 } 1125 }
1125 1126
1126 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 1127 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
1127 1128
1128 const CircleConicalInfo fInfo; 1129 const CircleConicalInfo fInfo;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf o); 1372 return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, inf o);
1372 } else if (type == kEdge_ConicalType) { 1373 } else if (type == kEdge_ConicalType) {
1373 set_matrix_edge_conical(shader, &matrix); 1374 set_matrix_edge_conical(shader, &matrix);
1374 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm); 1375 return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm);
1375 } else { 1376 } else {
1376 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in fo); 1377 return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, in fo);
1377 } 1378 }
1378 } 1379 }
1379 1380
1380 #endif 1381 #endif
OLDNEW
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698