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

Side by Side Diff: src/core/SkAnalyticEdge.h

Issue 2430343003: Use Analytic AA in SkAAClip (Closed)
Patch Set: Nit Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkAnalyticEdge_DEFINED 8 #ifndef SkAnalyticEdge_DEFINED
9 #define SkAnalyticEdge_DEFINED 9 #define SkAnalyticEdge_DEFINED
10 10
(...skipping 25 matching lines...) Expand all
36 // fDY is only used for blitting trapezoids. 36 // fDY is only used for blitting trapezoids.
37 37
38 int8_t fCurveCount; // only used by kQuad(+) and kCubic(-) 38 int8_t fCurveCount; // only used by kQuad(+) and kCubic(-)
39 uint8_t fCurveShift; // appled to all Dx/DDx/DDDx except for fCubicDShift exception 39 uint8_t fCurveShift; // appled to all Dx/DDx/DDDx except for fCubicDShift exception
40 uint8_t fCubicDShift; // applied to fCDx and fCDy only in cubic 40 uint8_t fCubicDShift; // applied to fCDx and fCDy only in cubic
41 int8_t fWinding; // 1 or -1 41 int8_t fWinding; // 1 or -1
42 42
43 static const int kDefaultAccuracy = 2; // default accuracy for snapping 43 static const int kDefaultAccuracy = 2; // default accuracy for snapping
44 44
45 static inline SkFixed snapY(SkFixed y, int accuracy = kDefaultAccuracy) { 45 static inline SkFixed snapY(SkFixed y, int accuracy = kDefaultAccuracy) {
46 return SkFixedRoundToFixed(y << accuracy) >> accuracy; 46 return (y + (SK_Fixed1 >> (accuracy + 1))) >> (16 - accuracy) << (16 - a ccuracy);
caryclark 2016/10/20 16:58:14 As I overheard mtklein say, this looks like a job
47 // The following does not work correctly for negative y. I've no idea wh y...
48 // return SkFixedRoundToFixed(y << accuracy) >> accuracy;
47 } 49 }
48 50
49 // Update fX, fY of this edge so fY = y 51 // Update fX, fY of this edge so fY = y
50 inline void goY(SkFixed y) { 52 inline void goY(SkFixed y) {
51 if (y == fY + SK_Fixed1) { 53 if (y == fY + SK_Fixed1) {
52 fX = fX + fDX; 54 fX = fX + fDX;
53 fY = y; 55 fY = y;
54 } else if (y != fY) { 56 } else if (y != fY) {
55 // Drop lower digits as our alpha only has 8 bits 57 // Drop lower digits as our alpha only has 8 bits
56 // (fDX and y - fUpperY may be greater than SK_Fixed1) 58 // (fDX and y - fUpperY may be greater than SK_Fixed1)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 fWinding = SkToS8(winding); 147 fWinding = SkToS8(winding);
146 fCurveShift = 0; 148 fCurveShift = 0;
147 149
148 if (clip) { 150 if (clip) {
149 this->chopLineWithClip(*clip); 151 this->chopLineWithClip(*clip);
150 } 152 }
151 return true; 153 return true;
152 } 154 }
153 155
154 #endif 156 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698