| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 The Android Open Source Project | 3 * Copyright 2011 The Android Open Source Project |
| 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 | 9 |
| 10 #include "SkScan.h" | 10 #include "SkScan.h" |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 // need precise rounding (not just SkAlphaMul) so that values like | 840 // need precise rounding (not just SkAlphaMul) so that values like |
| 841 // a=228, b=252 don't overflow the result | 841 // a=228, b=252 don't overflow the result |
| 842 return SkToU8(a + b - SkAlphaMulRound(a, b)); | 842 return SkToU8(a + b - SkAlphaMulRound(a, b)); |
| 843 } | 843 } |
| 844 | 844 |
| 845 static void inner_scanline(FDot8 L, int top, FDot8 R, U8CPU alpha, | 845 static void inner_scanline(FDot8 L, int top, FDot8 R, U8CPU alpha, |
| 846 SkBlitter* blitter) { | 846 SkBlitter* blitter) { |
| 847 SkASSERT(L < R); | 847 SkASSERT(L < R); |
| 848 | 848 |
| 849 if ((L >> 8) == ((R - 1) >> 8)) { // 1x1 pixel | 849 if ((L >> 8) == ((R - 1) >> 8)) { // 1x1 pixel |
| 850 blitter->blitV(L >> 8, top, 1, InvAlphaMul(alpha, R - L)); | 850 FDot8 widClamp = R - L; |
| 851 // border case clamp 256 to 255 instead of going through call_hline_blit
ter |
| 852 // see skbug/4406 |
| 853 widClamp = widClamp - (widClamp >> 8); |
| 854 blitter->blitV(L >> 8, top, 1, InvAlphaMul(alpha, widClamp)); |
| 851 return; | 855 return; |
| 852 } | 856 } |
| 853 | 857 |
| 854 int left = L >> 8; | 858 int left = L >> 8; |
| 855 if (L & 0xFF) { | 859 if (L & 0xFF) { |
| 856 blitter->blitV(left, top, 1, InvAlphaMul(alpha, L & 0xFF)); | 860 blitter->blitV(left, top, 1, InvAlphaMul(alpha, L & 0xFF)); |
| 857 left += 1; | 861 left += 1; |
| 858 } | 862 } |
| 859 | 863 |
| 860 int rite = R >> 8; | 864 int rite = R >> 8; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 | 998 |
| 995 void SkScan::AntiFrameRect(const SkRect& r, const SkPoint& strokeSize, | 999 void SkScan::AntiFrameRect(const SkRect& r, const SkPoint& strokeSize, |
| 996 const SkRasterClip& clip, SkBlitter* blitter) { | 1000 const SkRasterClip& clip, SkBlitter* blitter) { |
| 997 if (clip.isBW()) { | 1001 if (clip.isBW()) { |
| 998 AntiFrameRect(r, strokeSize, &clip.bwRgn(), blitter); | 1002 AntiFrameRect(r, strokeSize, &clip.bwRgn(), blitter); |
| 999 } else { | 1003 } else { |
| 1000 SkAAClipBlitterWrapper wrap(clip, blitter); | 1004 SkAAClipBlitterWrapper wrap(clip, blitter); |
| 1001 AntiFrameRect(r, strokeSize, &wrap.getRgn(), wrap.getBlitter()); | 1005 AntiFrameRect(r, strokeSize, &wrap.getRgn(), wrap.getBlitter()); |
| 1002 } | 1006 } |
| 1003 } | 1007 } |
| OLD | NEW |