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

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

Issue 2430343003: Use Analytic AA in SkAAClip (Closed)
Patch Set: Nit fixes 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
« no previous file with comments | « src/core/SkAAClip.cpp ('k') | src/core/SkBitmapDevice.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 * 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 // This approach is safer than left shift, round, then right shift
47 return (y + (SK_Fixed1 >> (accuracy + 1))) >> (16 - accuracy) << (16 - a ccuracy);
47 } 48 }
48 49
49 // Update fX, fY of this edge so fY = y 50 // Update fX, fY of this edge so fY = y
50 inline void goY(SkFixed y) { 51 inline void goY(SkFixed y) {
51 if (y == fY + SK_Fixed1) { 52 if (y == fY + SK_Fixed1) {
52 fX = fX + fDX; 53 fX = fX + fDX;
53 fY = y; 54 fY = y;
54 } else if (y != fY) { 55 } else if (y != fY) {
55 // Drop lower digits as our alpha only has 8 bits 56 // Drop lower digits as our alpha only has 8 bits
56 // (fDX and y - fUpperY may be greater than SK_Fixed1) 57 // (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); 146 fWinding = SkToS8(winding);
146 fCurveShift = 0; 147 fCurveShift = 0;
147 148
148 if (clip) { 149 if (clip) {
149 this->chopLineWithClip(*clip); 150 this->chopLineWithClip(*clip);
150 } 151 }
151 return true; 152 return true;
152 } 153 }
153 154
154 #endif 155 #endif
OLDNEW
« no previous file with comments | « src/core/SkAAClip.cpp ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698