| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 "SkAAClip.h" | 9 #include "SkAAClip.h" |
| 10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
| (...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 memcpy(dst, src, n); | 2039 memcpy(dst, src, n); |
| 2040 } | 2040 } |
| 2041 | 2041 |
| 2042 static void small_bzero(void* dst, size_t n) { | 2042 static void small_bzero(void* dst, size_t n) { |
| 2043 sk_bzero(dst, n); | 2043 sk_bzero(dst, n); |
| 2044 } | 2044 } |
| 2045 | 2045 |
| 2046 static inline uint8_t mergeOne(uint8_t value, unsigned alpha) { | 2046 static inline uint8_t mergeOne(uint8_t value, unsigned alpha) { |
| 2047 return SkMulDiv255Round(value, alpha); | 2047 return SkMulDiv255Round(value, alpha); |
| 2048 } | 2048 } |
| 2049 |
| 2049 static inline uint16_t mergeOne(uint16_t value, unsigned alpha) { | 2050 static inline uint16_t mergeOne(uint16_t value, unsigned alpha) { |
| 2050 unsigned r = SkGetPackedR16(value); | 2051 unsigned r = SkGetPackedR16(value); |
| 2051 unsigned g = SkGetPackedG16(value); | 2052 unsigned g = SkGetPackedG16(value); |
| 2052 unsigned b = SkGetPackedB16(value); | 2053 unsigned b = SkGetPackedB16(value); |
| 2053 return SkPackRGB16(SkMulDiv255Round(r, alpha), | 2054 return SkPackRGB16(SkMulDiv255Round(r, alpha), |
| 2054 SkMulDiv255Round(g, alpha), | 2055 SkMulDiv255Round(g, alpha), |
| 2055 SkMulDiv255Round(b, alpha)); | 2056 SkMulDiv255Round(b, alpha)); |
| 2056 } | 2057 } |
| 2057 static inline SkPMColor mergeOne(SkPMColor value, unsigned alpha) { | |
| 2058 unsigned a = SkGetPackedA32(value); | |
| 2059 unsigned r = SkGetPackedR32(value); | |
| 2060 unsigned g = SkGetPackedG32(value); | |
| 2061 unsigned b = SkGetPackedB32(value); | |
| 2062 return SkPackARGB32(SkMulDiv255Round(a, alpha), | |
| 2063 SkMulDiv255Round(r, alpha), | |
| 2064 SkMulDiv255Round(g, alpha), | |
| 2065 SkMulDiv255Round(b, alpha)); | |
| 2066 } | |
| 2067 | 2058 |
| 2068 template <typename T> void mergeT(const T* SK_RESTRICT src, int srcN, | 2059 template <typename T> void mergeT(const T* SK_RESTRICT src, int srcN, |
| 2069 const uint8_t* SK_RESTRICT row, int rowN, | 2060 const uint8_t* SK_RESTRICT row, int rowN, |
| 2070 T* SK_RESTRICT dst) { | 2061 T* SK_RESTRICT dst) { |
| 2071 for (;;) { | 2062 for (;;) { |
| 2072 SkASSERT(rowN > 0); | 2063 SkASSERT(rowN > 0); |
| 2073 SkASSERT(srcN > 0); | 2064 SkASSERT(srcN > 0); |
| 2074 | 2065 |
| 2075 int n = SkMin32(rowN, srcN); | 2066 int n = SkMin32(rowN, srcN); |
| 2076 unsigned rowA = row[1]; | 2067 unsigned rowA = row[1]; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2104 return NULL; | 2095 return NULL; |
| 2105 case SkMask::kA8_Format: | 2096 case SkMask::kA8_Format: |
| 2106 case SkMask::k3D_Format: { | 2097 case SkMask::k3D_Format: { |
| 2107 void (*proc8)(const uint8_t*, int, const uint8_t*, int, uint8_t*) =
mergeT; | 2098 void (*proc8)(const uint8_t*, int, const uint8_t*, int, uint8_t*) =
mergeT; |
| 2108 return (MergeAAProc)proc8; | 2099 return (MergeAAProc)proc8; |
| 2109 } | 2100 } |
| 2110 case SkMask::kLCD16_Format: { | 2101 case SkMask::kLCD16_Format: { |
| 2111 void (*proc16)(const uint16_t*, int, const uint8_t*, int, uint16_t*)
= mergeT; | 2102 void (*proc16)(const uint16_t*, int, const uint8_t*, int, uint16_t*)
= mergeT; |
| 2112 return (MergeAAProc)proc16; | 2103 return (MergeAAProc)proc16; |
| 2113 } | 2104 } |
| 2114 case SkMask::kLCD32_Format: { | |
| 2115 void (*proc32)(const SkPMColor*, int, const uint8_t*, int, SkPMColor
*) = mergeT; | |
| 2116 return (MergeAAProc)proc32; | |
| 2117 } | |
| 2118 default: | 2105 default: |
| 2119 SkDEBUGFAIL("unsupported"); | 2106 SkDEBUGFAIL("unsupported"); |
| 2120 return NULL; | 2107 return NULL; |
| 2121 } | 2108 } |
| 2122 } | 2109 } |
| 2123 | 2110 |
| 2124 static U8CPU bit2byte(int bitInAByte) { | 2111 static U8CPU bit2byte(int bitInAByte) { |
| 2125 SkASSERT(bitInAByte <= 0xFF); | 2112 SkASSERT(bitInAByte <= 0xFF); |
| 2126 // negation turns any non-zero into 0xFFFFFF??, so we just shift down | 2113 // negation turns any non-zero into 0xFFFFFF??, so we just shift down |
| 2127 // some value >= 8 to get a full FF value | 2114 // some value >= 8 to get a full FF value |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2228 rowMask.fBounds.fBottom = y + 1; | 2215 rowMask.fBounds.fBottom = y + 1; |
| 2229 fBlitter->blitMask(rowMask, rowMask.fBounds); | 2216 fBlitter->blitMask(rowMask, rowMask.fBounds); |
| 2230 src = (const void*)((const char*)src + srcRB); | 2217 src = (const void*)((const char*)src + srcRB); |
| 2231 } while (++y < localStopY); | 2218 } while (++y < localStopY); |
| 2232 } while (y < stopY); | 2219 } while (y < stopY); |
| 2233 } | 2220 } |
| 2234 | 2221 |
| 2235 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { | 2222 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { |
| 2236 return NULL; | 2223 return NULL; |
| 2237 } | 2224 } |
| OLD | NEW |