Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 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 "SkAAClip.h" | 8 #include "SkAAClip.h" |
| 9 #include "SkAtomics.h" | 9 #include "SkAtomics.h" |
| 10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1324 const int16_t runs[]) override { | 1324 const int16_t runs[]) override { |
| 1325 this->recordMinY(y); | 1325 this->recordMinY(y); |
| 1326 this->checkForYGap(y); | 1326 this->checkForYGap(y); |
| 1327 for (;;) { | 1327 for (;;) { |
| 1328 int count = *runs; | 1328 int count = *runs; |
| 1329 if (count <= 0) { | 1329 if (count <= 0) { |
| 1330 return; | 1330 return; |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 // The supersampler's buffer can be the width of the device, so | 1333 // The supersampler's buffer can be the width of the device, so |
| 1334 // we may have to trim the run to our bounds. If so, we assert that | 1334 // we may have to trim the run to our bounds. Previously, we assert that |
| 1335 // the extra spans are always alpha==0 | 1335 // the extra spans are always alpha==0. |
| 1336 // However, the analytic AA is too sensitive to precision errors | |
| 1337 // so it may have extra spans with very tiny alpha because after sev eral | |
| 1338 // arithmatic operations, the edge may bleed the path boundary a lit tle bit. | |
| 1339 // Therefore, instead of always asserting alpha==0, we assert alpha < 0x10. | |
|
caryclark
2016/11/07 16:50:51
The assert below disagrees with the comment; it as
liyuqian
2016/11/08 16:33:47
Is SkASSERT(0x10 > *alpha) equivalent to SkASSERT(
| |
| 1336 int localX = x; | 1340 int localX = x; |
| 1337 int localCount = count; | 1341 int localCount = count; |
| 1338 if (x < fLeft) { | 1342 if (x < fLeft) { |
| 1339 SkASSERT(0 == *alpha); | 1343 SkASSERT(0x10 > *alpha); |
| 1340 int gap = fLeft - x; | 1344 int gap = fLeft - x; |
| 1341 SkASSERT(gap <= count); | 1345 SkASSERT(gap <= count); |
| 1342 localX += gap; | 1346 localX += gap; |
| 1343 localCount -= gap; | 1347 localCount -= gap; |
| 1344 } | 1348 } |
| 1345 int right = x + count; | 1349 int right = x + count; |
| 1346 if (right > fRight) { | 1350 if (right > fRight) { |
| 1347 SkASSERT(0 == *alpha); | 1351 SkASSERT(0x10 > *alpha); |
| 1348 localCount -= right - fRight; | 1352 localCount -= right - fRight; |
| 1349 SkASSERT(localCount >= 0); | 1353 SkASSERT(localCount >= 0); |
| 1350 } | 1354 } |
| 1351 | 1355 |
| 1352 if (localCount) { | 1356 if (localCount) { |
| 1353 fBuilder->addRun(localX, y, *alpha, localCount); | 1357 fBuilder->addRun(localX, y, *alpha, localCount); |
| 1354 } | 1358 } |
| 1355 // Next run | 1359 // Next run |
| 1356 runs += count; | 1360 runs += count; |
| 1357 alpha += count; | 1361 alpha += count; |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2228 rowMask.fBounds.fBottom = y + 1; | 2232 rowMask.fBounds.fBottom = y + 1; |
| 2229 fBlitter->blitMask(rowMask, rowMask.fBounds); | 2233 fBlitter->blitMask(rowMask, rowMask.fBounds); |
| 2230 src = (const void*)((const char*)src + srcRB); | 2234 src = (const void*)((const char*)src + srcRB); |
| 2231 } while (++y < localStopY); | 2235 } while (++y < localStopY); |
| 2232 } while (y < stopY); | 2236 } while (y < stopY); |
| 2233 } | 2237 } |
| 2234 | 2238 |
| 2235 const SkPixmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { | 2239 const SkPixmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { |
| 2236 return nullptr; | 2240 return nullptr; |
| 2237 } | 2241 } |
| OLD | NEW |