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

Side by Side Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 1135053002: stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix xpsdevice 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/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrOvalRenderer.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 2012 Google Inc. 3 * Copyright 2012 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 "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 for (int i = 0; i < count; ++i) { 97 for (int i = 0; i < count; ++i) {
98 const SkPoint& pt = segments[i].endPt(); 98 const SkPoint& pt = segments[i].endPt();
99 avg.fX += pt.fX; 99 avg.fX += pt.fX;
100 avg.fY += pt.fY; 100 avg.fY += pt.fY;
101 } 101 }
102 SkScalar denom = SK_Scalar1 / count; 102 SkScalar denom = SK_Scalar1 / count;
103 avg.scale(denom); 103 avg.scale(denom);
104 *c = avg; 104 *c = avg;
105 } else { 105 } else {
106 area *= 3; 106 area *= 3;
107 area = SkScalarDiv(SK_Scalar1, area); 107 area = SkScalarInvert(area);
108 center.fX = SkScalarMul(center.fX, area); 108 center.fX = SkScalarMul(center.fX, area);
109 center.fY = SkScalarMul(center.fY, area); 109 center.fY = SkScalarMul(center.fY, area);
110 // undo the translate of p0 to the origin. 110 // undo the translate of p0 to the origin.
111 *c = center + p0; 111 *c = center + p0;
112 } 112 }
113 SkASSERT(!SkScalarIsNaN(c->fX) && !SkScalarIsNaN(c->fY)); 113 SkASSERT(!SkScalarIsNaN(c->fX) && !SkScalarIsNaN(c->fY));
114 } 114 }
115 115
116 static void compute_vectors(SegmentArray* segments, 116 static void compute_vectors(SegmentArray* segments,
117 SkPoint* fanPt, 117 SkPoint* fanPt,
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 geometry.fColor = color; 1029 geometry.fColor = color;
1030 geometry.fViewMatrix = vm; 1030 geometry.fViewMatrix = vm;
1031 geometry.fPath = path; 1031 geometry.fPath = path;
1032 1032
1033 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); 1033 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
1034 target->drawBatch(pipelineBuilder, batch); 1034 target->drawBatch(pipelineBuilder, batch);
1035 1035
1036 return true; 1036 return true;
1037 1037
1038 } 1038 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698