| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 523 } |
| 524 | 524 |
| 525 // Look to trim away empty rows from the bottom. | 525 // Look to trim away empty rows from the bottom. |
| 526 // We know that we have at least one non-zero row, so we can just walk | 526 // We know that we have at least one non-zero row, so we can just walk |
| 527 // backwards without checking for running past the start. | 527 // backwards without checking for running past the start. |
| 528 // | 528 // |
| 529 stop = yoff = head->yoffsets() + head->fRowCount; | 529 stop = yoff = head->yoffsets() + head->fRowCount; |
| 530 do { | 530 do { |
| 531 yoff -= 1; | 531 yoff -= 1; |
| 532 } while (row_is_all_zeros(base + yoff->fOffset, width)); | 532 } while (row_is_all_zeros(base + yoff->fOffset, width)); |
| 533 skip = stop - yoff - 1; | 533 skip = SkToInt(stop - yoff - 1); |
| 534 SkASSERT(skip >= 0 && skip < head->fRowCount); | 534 SkASSERT(skip >= 0 && skip < head->fRowCount); |
| 535 if (skip > 0) { | 535 if (skip > 0) { |
| 536 // removing from the bottom is easier than from the top, as we don't | 536 // removing from the bottom is easier than from the top, as we don't |
| 537 // have to adjust any of the Y values, we just have to trim the array | 537 // have to adjust any of the Y values, we just have to trim the array |
| 538 memmove(stop - skip, stop, head->fDataSize); | 538 memmove(stop - skip, stop, head->fDataSize); |
| 539 | 539 |
| 540 fBounds.fBottom = fBounds.fTop + yoff->fY + 1; | 540 fBounds.fBottom = fBounds.fTop + yoff->fY + 1; |
| 541 SkASSERT(!fBounds.isEmpty()); | 541 SkASSERT(!fBounds.isEmpty()); |
| 542 head->fRowCount -= skip; | 542 head->fRowCount -= skip; |
| 543 SkASSERT(head->fRowCount > 0); | 543 SkASSERT(head->fRowCount > 0); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 uint8_t* data = head->data(); | 1026 uint8_t* data = head->data(); |
| 1027 uint8_t* baseData = data; | 1027 uint8_t* baseData = data; |
| 1028 | 1028 |
| 1029 row = fRows.begin(); | 1029 row = fRows.begin(); |
| 1030 SkDEBUGCODE(int prevY = row->fY - 1;) | 1030 SkDEBUGCODE(int prevY = row->fY - 1;) |
| 1031 while (row < stop) { | 1031 while (row < stop) { |
| 1032 SkASSERT(prevY < row->fY); // must be monotonic | 1032 SkASSERT(prevY < row->fY); // must be monotonic |
| 1033 SkDEBUGCODE(prevY = row->fY); | 1033 SkDEBUGCODE(prevY = row->fY); |
| 1034 | 1034 |
| 1035 yoffset->fY = row->fY - adjustY; | 1035 yoffset->fY = row->fY - adjustY; |
| 1036 yoffset->fOffset = data - baseData; | 1036 yoffset->fOffset = SkToU32(data - baseData); |
| 1037 yoffset += 1; | 1037 yoffset += 1; |
| 1038 | 1038 |
| 1039 size_t n = row->fData->count(); | 1039 size_t n = row->fData->count(); |
| 1040 memcpy(data, row->fData->begin(), n); | 1040 memcpy(data, row->fData->begin(), n); |
| 1041 #ifdef SK_DEBUG | 1041 #ifdef SK_DEBUG |
| 1042 size_t bytesNeeded = compute_row_length(data, fBounds.width()); | 1042 size_t bytesNeeded = compute_row_length(data, fBounds.width()); |
| 1043 SkASSERT(bytesNeeded == n); | 1043 SkASSERT(bytesNeeded == n); |
| 1044 #endif | 1044 #endif |
| 1045 data += n; | 1045 data += n; |
| 1046 | 1046 |
| (...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 rowMask.fBounds.fBottom = y + 1; | 2160 rowMask.fBounds.fBottom = y + 1; |
| 2161 fBlitter->blitMask(rowMask, rowMask.fBounds); | 2161 fBlitter->blitMask(rowMask, rowMask.fBounds); |
| 2162 src = (const void*)((const char*)src + srcRB); | 2162 src = (const void*)((const char*)src + srcRB); |
| 2163 } while (++y < localStopY); | 2163 } while (++y < localStopY); |
| 2164 } while (y < stopY); | 2164 } while (y < stopY); |
| 2165 } | 2165 } |
| 2166 | 2166 |
| 2167 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { | 2167 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { |
| 2168 return NULL; | 2168 return NULL; |
| 2169 } | 2169 } |
| OLD | NEW |