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

Side by Side Diff: src/core/SkScan_AAAPath.cpp

Issue 2499723002: Revert of Set analytic AA as default. (Closed)
Patch Set: Created 4 years, 1 month 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/SkScan.cpp ('k') | src/core/SkXfermode.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 2016 The Android Open Source Project 2 * Copyright 2016 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 #include "SkAntiRun.h" 8 #include "SkAntiRun.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkEdge.h" 10 #include "SkEdge.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // return ((((a >> 8) * (a >> 8)) >> 8) * (b >> 8)) >> 1; 474 // return ((((a >> 8) * (a >> 8)) >> 8) * (b >> 8)) >> 1;
475 return (a >> 11) * (a >> 11) * (b >> 11); 475 return (a >> 11) * (a >> 11) * (b >> 11);
476 } 476 }
477 477
478 // The alpha of right-triangle (a, a*b) 478 // The alpha of right-triangle (a, a*b)
479 static inline SkAlpha partialTriangleToAlpha(SkFixed a, SkFixed b) { 479 static inline SkAlpha partialTriangleToAlpha(SkFixed a, SkFixed b) {
480 return partialTriangleToAlpha16(a, b) >> 8; 480 return partialTriangleToAlpha16(a, b) >> 8;
481 } 481 }
482 482
483 static inline SkAlpha getPartialAlpha(SkAlpha alpha, SkFixed partialHeight) { 483 static inline SkAlpha getPartialAlpha(SkAlpha alpha, SkFixed partialHeight) {
484 return SkToU8(SkFixedRoundToInt(alpha * partialHeight)); 484 return (alpha * partialHeight + SK_FixedHalf) >> 16;
485 } 485 }
486 486
487 static inline SkAlpha getPartialAlpha(SkAlpha alpha, SkAlpha fullAlpha) { 487 static inline SkAlpha getPartialAlpha(SkAlpha alpha, SkAlpha fullAlpha) {
488 return ((uint16_t)alpha * fullAlpha) >> 8; 488 return ((uint16_t)alpha * fullAlpha) >> 8;
489 } 489 }
490 490
491 // For SkFixed that's close to SK_Fixed1, we can't convert it to alpha by just s hifting right. 491 // For SkFixed that's close to SK_Fixed1, we can't convert it to alpha by just s hifting right.
492 // For example, when f = SK_Fixed1, right shifting 8 will get 256, but we need 2 55. 492 // For example, when f = SK_Fixed1, right shifting 8 will get 256, but we need 2 55.
493 // This is rarely the problem so we'll only use this for blitting rectangles. 493 // This is rarely the problem so we'll only use this for blitting rectangles.
494 static inline SkAlpha f2a(SkFixed f) { 494 static inline SkAlpha f2a(SkFixed f) {
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 AAAFillPath(path, clip.bwRgn(), blitter); 1344 AAAFillPath(path, clip.bwRgn(), blitter);
1345 } else { 1345 } else {
1346 SkRegion tmp; 1346 SkRegion tmp;
1347 SkAAClipBlitter aaBlitter; 1347 SkAAClipBlitter aaBlitter;
1348 1348
1349 tmp.setRect(clip.getBounds()); 1349 tmp.setRect(clip.getBounds());
1350 aaBlitter.init(blitter, &clip.aaRgn()); 1350 aaBlitter.init(blitter, &clip.aaRgn());
1351 AAAFillPath(path, tmp, &aaBlitter, true); 1351 AAAFillPath(path, tmp, &aaBlitter, true);
1352 } 1352 }
1353 } 1353 }
OLDNEW
« no previous file with comments | « src/core/SkScan.cpp ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698