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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 return this->setPath(path); | 677 return this->setPath(path); |
678 #else | 678 #else |
679 this->freeRuns(); | 679 this->freeRuns(); |
680 fBounds = bounds; | 680 fBounds = bounds; |
681 fRunHead = RunHead::AllocRect(bounds); | 681 fRunHead = RunHead::AllocRect(bounds); |
682 SkASSERT(!this->isEmpty()); | 682 SkASSERT(!this->isEmpty()); |
683 return true; | 683 return true; |
684 #endif | 684 #endif |
685 } | 685 } |
686 | 686 |
| 687 bool SkAAClip::isRect() const { |
| 688 if (this->isEmpty()) { |
| 689 return false; |
| 690 } |
| 691 |
| 692 const RunHead* head = fRunHead; |
| 693 if (head->fRowCount != 1) { |
| 694 return false; |
| 695 } |
| 696 const YOffset* yoff = head->yoffsets(); |
| 697 if (yoff->fY != fBounds.fBottom - 1) { |
| 698 return false; |
| 699 } |
| 700 |
| 701 const uint8_t* row = head->data() + yoff->fOffset; |
| 702 int width = fBounds.width(); |
| 703 do { |
| 704 if (row[1] != 0xFF) { |
| 705 return false; |
| 706 } |
| 707 int n = row[0]; |
| 708 SkASSERT(n <= width); |
| 709 width -= n; |
| 710 row += 2; |
| 711 } while (width > 0); |
| 712 return true; |
| 713 } |
| 714 |
687 bool SkAAClip::setRect(const SkRect& r, bool doAA) { | 715 bool SkAAClip::setRect(const SkRect& r, bool doAA) { |
688 if (r.isEmpty()) { | 716 if (r.isEmpty()) { |
689 return this->setEmpty(); | 717 return this->setEmpty(); |
690 } | 718 } |
691 | 719 |
692 AUTO_AACLIP_VALIDATE(*this); | 720 AUTO_AACLIP_VALIDATE(*this); |
693 | 721 |
694 // TODO: special case this | 722 // TODO: special case this |
695 | 723 |
696 SkPath path; | 724 SkPath path; |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 rowMask.fBounds.fBottom = y + 1; | 2188 rowMask.fBounds.fBottom = y + 1; |
2161 fBlitter->blitMask(rowMask, rowMask.fBounds); | 2189 fBlitter->blitMask(rowMask, rowMask.fBounds); |
2162 src = (const void*)((const char*)src + srcRB); | 2190 src = (const void*)((const char*)src + srcRB); |
2163 } while (++y < localStopY); | 2191 } while (++y < localStopY); |
2164 } while (y < stopY); | 2192 } while (y < stopY); |
2165 } | 2193 } |
2166 | 2194 |
2167 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { | 2195 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { |
2168 return NULL; | 2196 return NULL; |
2169 } | 2197 } |
OLD | NEW |