Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/core/SkAAClip.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkAAClip.h ('k') | src/core/SkAdvancedTypefaceMetrics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkAtomics.h" 10 #include "SkAtomics.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 const uint8_t* fData; 129 const uint8_t* fData;
130 130
131 int fTop, fBottom; 131 int fTop, fBottom;
132 bool fDone; 132 bool fDone;
133 }; 133 };
134 134
135 SkAAClip::Iter::Iter(const SkAAClip& clip) { 135 SkAAClip::Iter::Iter(const SkAAClip& clip) {
136 if (clip.isEmpty()) { 136 if (clip.isEmpty()) {
137 fDone = true; 137 fDone = true;
138 fTop = fBottom = clip.fBounds.fBottom; 138 fTop = fBottom = clip.fBounds.fBottom;
139 fData = NULL; 139 fData = nullptr;
140 fCurrYOff = NULL; 140 fCurrYOff = nullptr;
141 fStopYOff = NULL; 141 fStopYOff = nullptr;
142 return; 142 return;
143 } 143 }
144 144
145 const RunHead* head = clip.fRunHead; 145 const RunHead* head = clip.fRunHead;
146 fCurrYOff = head->yoffsets(); 146 fCurrYOff = head->yoffsets();
147 fStopYOff = fCurrYOff + head->fRowCount; 147 fStopYOff = fCurrYOff + head->fRowCount;
148 fData = head->data() + fCurrYOff->fOffset; 148 fData = head->data() + fCurrYOff->fOffset;
149 149
150 // setup first value 150 // setup first value
151 fTop = clip.fBounds.fTop; 151 fTop = clip.fBounds.fTop;
152 fBottom = clip.fBounds.fTop + fCurrYOff->fY + 1; 152 fBottom = clip.fBounds.fTop + fCurrYOff->fY + 1;
153 fDone = false; 153 fDone = false;
154 } 154 }
155 155
156 void SkAAClip::Iter::next() { 156 void SkAAClip::Iter::next() {
157 if (!fDone) { 157 if (!fDone) {
158 const YOffset* prev = fCurrYOff; 158 const YOffset* prev = fCurrYOff;
159 const YOffset* curr = prev + 1; 159 const YOffset* curr = prev + 1;
160 SkASSERT(curr <= fStopYOff); 160 SkASSERT(curr <= fStopYOff);
161 161
162 fTop = fBottom; 162 fTop = fBottom;
163 if (curr >= fStopYOff) { 163 if (curr >= fStopYOff) {
164 fDone = true; 164 fDone = true;
165 fBottom = kMaxInt32; 165 fBottom = kMaxInt32;
166 fData = NULL; 166 fData = nullptr;
167 } else { 167 } else {
168 fBottom += curr->fY - prev->fY; 168 fBottom += curr->fY - prev->fY;
169 fData += curr->fOffset - prev->fOffset; 169 fData += curr->fOffset - prev->fOffset;
170 fCurrYOff = curr; 170 fCurrYOff = curr;
171 } 171 }
172 } 172 }
173 } 173 }
174 174
175 #ifdef SK_DEBUG 175 #ifdef SK_DEBUG
176 // assert we're exactly width-wide, and then return the number of bytes used 176 // assert we're exactly width-wide, and then return the number of bytes used
177 static size_t compute_row_length(const uint8_t row[], int width) { 177 static size_t compute_row_length(const uint8_t row[], int width) {
178 const uint8_t* origRow = row; 178 const uint8_t* origRow = row;
179 while (width > 0) { 179 while (width > 0) {
180 int n = row[0]; 180 int n = row[0];
181 SkASSERT(n > 0); 181 SkASSERT(n > 0);
182 SkASSERT(n <= width); 182 SkASSERT(n <= width);
183 row += 2; 183 row += 2;
184 width -= n; 184 width -= n;
185 } 185 }
186 SkASSERT(0 == width); 186 SkASSERT(0 == width);
187 return row - origRow; 187 return row - origRow;
188 } 188 }
189 189
190 void SkAAClip::validate() const { 190 void SkAAClip::validate() const {
191 if (NULL == fRunHead) { 191 if (nullptr == fRunHead) {
192 SkASSERT(fBounds.isEmpty()); 192 SkASSERT(fBounds.isEmpty());
193 return; 193 return;
194 } 194 }
195 195
196 const RunHead* head = fRunHead; 196 const RunHead* head = fRunHead;
197 SkASSERT(head->fRefCnt > 0); 197 SkASSERT(head->fRefCnt > 0);
198 SkASSERT(head->fRowCount > 0); 198 SkASSERT(head->fRowCount > 0);
199 199
200 const YOffset* yoff = head->yoffsets(); 200 const YOffset* yoff = head->yoffsets();
201 const YOffset* ystop = yoff + head->fRowCount; 201 const YOffset* ystop = yoff + head->fRowCount;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 if (fRunHead) { 618 if (fRunHead) {
619 SkASSERT(fRunHead->fRefCnt >= 1); 619 SkASSERT(fRunHead->fRefCnt >= 1);
620 if (1 == sk_atomic_dec(&fRunHead->fRefCnt)) { 620 if (1 == sk_atomic_dec(&fRunHead->fRefCnt)) {
621 sk_free(fRunHead); 621 sk_free(fRunHead);
622 } 622 }
623 } 623 }
624 } 624 }
625 625
626 SkAAClip::SkAAClip() { 626 SkAAClip::SkAAClip() {
627 fBounds.setEmpty(); 627 fBounds.setEmpty();
628 fRunHead = NULL; 628 fRunHead = nullptr;
629 } 629 }
630 630
631 SkAAClip::SkAAClip(const SkAAClip& src) { 631 SkAAClip::SkAAClip(const SkAAClip& src) {
632 SkDEBUGCODE(fBounds.setEmpty();) // need this for validate 632 SkDEBUGCODE(fBounds.setEmpty();) // need this for validate
633 fRunHead = NULL; 633 fRunHead = nullptr;
634 *this = src; 634 *this = src;
635 } 635 }
636 636
637 SkAAClip::~SkAAClip() { 637 SkAAClip::~SkAAClip() {
638 this->freeRuns(); 638 this->freeRuns();
639 } 639 }
640 640
641 SkAAClip& SkAAClip::operator=(const SkAAClip& src) { 641 SkAAClip& SkAAClip::operator=(const SkAAClip& src) {
642 AUTO_AACLIP_VALIDATE(*this); 642 AUTO_AACLIP_VALIDATE(*this);
643 src.validate(); 643 src.validate();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 691 }
692 692
693 bool SkAAClip::set(const SkAAClip& src) { 693 bool SkAAClip::set(const SkAAClip& src) {
694 *this = src; 694 *this = src;
695 return !this->isEmpty(); 695 return !this->isEmpty();
696 } 696 }
697 697
698 bool SkAAClip::setEmpty() { 698 bool SkAAClip::setEmpty() {
699 this->freeRuns(); 699 this->freeRuns();
700 fBounds.setEmpty(); 700 fBounds.setEmpty();
701 fRunHead = NULL; 701 fRunHead = nullptr;
702 return false; 702 return false;
703 } 703 }
704 704
705 bool SkAAClip::setRect(const SkIRect& bounds) { 705 bool SkAAClip::setRect(const SkIRect& bounds) {
706 if (bounds.isEmpty()) { 706 if (bounds.isEmpty()) {
707 return this->setEmpty(); 707 return this->setEmpty();
708 } 708 }
709 709
710 AUTO_AACLIP_VALIDATE(*this); 710 AUTO_AACLIP_VALIDATE(*this);
711 711
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 if (r.isEmpty()) { 756 if (r.isEmpty()) {
757 return this->setEmpty(); 757 return this->setEmpty();
758 } 758 }
759 759
760 AUTO_AACLIP_VALIDATE(*this); 760 AUTO_AACLIP_VALIDATE(*this);
761 761
762 // TODO: special case this 762 // TODO: special case this
763 763
764 SkPath path; 764 SkPath path;
765 path.addRect(r); 765 path.addRect(r);
766 return this->setPath(path, NULL, doAA); 766 return this->setPath(path, nullptr, doAA);
767 } 767 }
768 768
769 static void append_run(SkTDArray<uint8_t>& array, uint8_t value, int count) { 769 static void append_run(SkTDArray<uint8_t>& array, uint8_t value, int count) {
770 SkASSERT(count >= 0); 770 SkASSERT(count >= 0);
771 while (count > 0) { 771 while (count > 0) {
772 int n = count; 772 int n = count;
773 if (n > 255) { 773 if (n > 255) {
774 n = 255; 774 n = 255;
775 } 775 }
776 uint8_t* data = array.append(2); 776 uint8_t* data = array.append(2);
(...skipping 26 matching lines...) Expand all
803 803
804 SkTDArray<YOffset> yArray; 804 SkTDArray<YOffset> yArray;
805 SkTDArray<uint8_t> xArray; 805 SkTDArray<uint8_t> xArray;
806 806
807 yArray.setReserve(SkMin32(bounds.height(), 1024)); 807 yArray.setReserve(SkMin32(bounds.height(), 1024));
808 xArray.setReserve(SkMin32(bounds.width() * 128, 64 * 1024)); 808 xArray.setReserve(SkMin32(bounds.width() * 128, 64 * 1024));
809 809
810 SkRegion::Iterator iter(rgn); 810 SkRegion::Iterator iter(rgn);
811 int prevRight = 0; 811 int prevRight = 0;
812 int prevBot = 0; 812 int prevBot = 0;
813 YOffset* currY = NULL; 813 YOffset* currY = nullptr;
814 814
815 for (; !iter.done(); iter.next()) { 815 for (; !iter.done(); iter.next()) {
816 const SkIRect& r = iter.rect(); 816 const SkIRect& r = iter.rect();
817 SkASSERT(bounds.contains(r)); 817 SkASSERT(bounds.contains(r));
818 818
819 int bot = r.fBottom - offsetY; 819 int bot = r.fBottom - offsetY;
820 SkASSERT(bot >= prevBot); 820 SkASSERT(bot >= prevBot);
821 if (bot > prevBot) { 821 if (bot > prevBot) {
822 if (currY) { 822 if (currY) {
823 // flush current row 823 // flush current row
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 return true; 862 return true;
863 #endif 863 #endif
864 } 864 }
865 865
866 /////////////////////////////////////////////////////////////////////////////// 866 ///////////////////////////////////////////////////////////////////////////////
867 867
868 const uint8_t* SkAAClip::findRow(int y, int* lastYForRow) const { 868 const uint8_t* SkAAClip::findRow(int y, int* lastYForRow) const {
869 SkASSERT(fRunHead); 869 SkASSERT(fRunHead);
870 870
871 if (!y_in_rect(y, fBounds)) { 871 if (!y_in_rect(y, fBounds)) {
872 return NULL; 872 return nullptr;
873 } 873 }
874 y -= fBounds.y(); // our yoffs values are relative to the top 874 y -= fBounds.y(); // our yoffs values are relative to the top
875 875
876 const YOffset* yoff = fRunHead->yoffsets(); 876 const YOffset* yoff = fRunHead->yoffsets();
877 while (yoff->fY < y) { 877 while (yoff->fY < y) {
878 yoff += 1; 878 yoff += 1;
879 SkASSERT(yoff - fRunHead->yoffsets() < fRunHead->fRowCount); 879 SkASSERT(yoff - fRunHead->yoffsets() < fRunHead->fRowCount);
880 } 880 }
881 881
882 if (lastYForRow) { 882 if (lastYForRow) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 SkTDArray<Row> fRows; 953 SkTDArray<Row> fRows;
954 Row* fCurrRow; 954 Row* fCurrRow;
955 int fPrevY; 955 int fPrevY;
956 int fWidth; 956 int fWidth;
957 int fMinY; 957 int fMinY;
958 958
959 public: 959 public:
960 Builder(const SkIRect& bounds) : fBounds(bounds) { 960 Builder(const SkIRect& bounds) : fBounds(bounds) {
961 fPrevY = -1; 961 fPrevY = -1;
962 fWidth = bounds.width(); 962 fWidth = bounds.width();
963 fCurrRow = NULL; 963 fCurrRow = nullptr;
964 fMinY = bounds.fTop; 964 fMinY = bounds.fTop;
965 } 965 }
966 966
967 ~Builder() { 967 ~Builder() {
968 Row* row = fRows.begin(); 968 Row* row = fRows.begin();
969 Row* stop = fRows.end(); 969 Row* stop = fRows.end();
970 while (row < stop) { 970 while (row < stop) {
971 delete row->fData; 971 delete row->fData;
972 row += 1; 972 row += 1;
973 } 973 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 private: 1174 private:
1175 void flushRowH(Row* row) { 1175 void flushRowH(Row* row) {
1176 // flush current row if needed 1176 // flush current row if needed
1177 if (row->fWidth < fWidth) { 1177 if (row->fWidth < fWidth) {
1178 AppendRun(*row->fData, 0, fWidth - row->fWidth); 1178 AppendRun(*row->fData, 0, fWidth - row->fWidth);
1179 row->fWidth = fWidth; 1179 row->fWidth = fWidth;
1180 } 1180 }
1181 } 1181 }
1182 1182
1183 Row* flushRow(bool readyForAnother) { 1183 Row* flushRow(bool readyForAnother) {
1184 Row* next = NULL; 1184 Row* next = nullptr;
1185 int count = fRows.count(); 1185 int count = fRows.count();
1186 if (count > 0) { 1186 if (count > 0) {
1187 this->flushRowH(&fRows[count - 1]); 1187 this->flushRowH(&fRows[count - 1]);
1188 } 1188 }
1189 if (count > 1) { 1189 if (count > 1) {
1190 // are our last two runs the same? 1190 // are our last two runs the same?
1191 Row* prev = &fRows[count - 2]; 1191 Row* prev = &fRows[count - 2];
1192 Row* curr = &fRows[count - 1]; 1192 Row* curr = &fRows[count - 1];
1193 SkASSERT(prev->fWidth == fWidth); 1193 SkASSERT(prev->fWidth == fWidth);
1194 SkASSERT(curr->fWidth == fWidth); 1194 SkASSERT(curr->fWidth == fWidth);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 this->recordMinY(y); 1291 this->recordMinY(y);
1292 this->checkForYGap(y); 1292 this->checkForYGap(y);
1293 fBuilder->addAntiRectRun(x, y, width, height, leftAlpha, rightAlpha); 1293 fBuilder->addAntiRectRun(x, y, width, height, leftAlpha, rightAlpha);
1294 fLastY = y + height - 1; 1294 fLastY = y + height - 1;
1295 } 1295 }
1296 1296
1297 void blitMask(const SkMask&, const SkIRect& clip) override 1297 void blitMask(const SkMask&, const SkIRect& clip) override
1298 { unexpected(); } 1298 { unexpected(); }
1299 1299
1300 const SkPixmap* justAnOpaqueColor(uint32_t*) override { 1300 const SkPixmap* justAnOpaqueColor(uint32_t*) override {
1301 return NULL; 1301 return nullptr;
1302 } 1302 }
1303 1303
1304 void blitH(int x, int y, int width) override { 1304 void blitH(int x, int y, int width) override {
1305 this->recordMinY(y); 1305 this->recordMinY(y);
1306 this->checkForYGap(y); 1306 this->checkForYGap(y);
1307 fBuilder->addRun(x, y, 0xFF, width); 1307 fBuilder->addRun(x, y, 0xFF, width);
1308 } 1308 }
1309 1309
1310 virtual void blitAntiH(int x, int y, const SkAlpha alpha[], 1310 virtual void blitAntiH(int x, int y, const SkAlpha alpha[],
1311 const int16_t runs[]) override { 1311 const int16_t runs[]) override {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 AUTO_AACLIP_VALIDATE(*this); 1374 AUTO_AACLIP_VALIDATE(*this);
1375 1375
1376 if (clip && clip->isEmpty()) { 1376 if (clip && clip->isEmpty()) {
1377 return this->setEmpty(); 1377 return this->setEmpty();
1378 } 1378 }
1379 1379
1380 SkIRect ibounds; 1380 SkIRect ibounds;
1381 path.getBounds().roundOut(&ibounds); 1381 path.getBounds().roundOut(&ibounds);
1382 1382
1383 SkRegion tmpClip; 1383 SkRegion tmpClip;
1384 if (NULL == clip) { 1384 if (nullptr == clip) {
1385 tmpClip.setRect(ibounds); 1385 tmpClip.setRect(ibounds);
1386 clip = &tmpClip; 1386 clip = &tmpClip;
1387 } 1387 }
1388 1388
1389 if (path.isInverseFillType()) { 1389 if (path.isInverseFillType()) {
1390 ibounds = clip->getBounds(); 1390 ibounds = clip->getBounds();
1391 } else { 1391 } else {
1392 if (ibounds.isEmpty() || !ibounds.intersect(clip->getBounds())) { 1392 if (ibounds.isEmpty() || !ibounds.intersect(clip->getBounds())) {
1393 return this->setEmpty(); 1393 return this->setEmpty();
1394 } 1394 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 SkAAClip::Iter iterB(B); 1601 SkAAClip::Iter iterB(B);
1602 1602
1603 SkASSERT(!iterA.done()); 1603 SkASSERT(!iterA.done());
1604 int topA = iterA.top(); 1604 int topA = iterA.top();
1605 int botA = iterA.bottom(); 1605 int botA = iterA.bottom();
1606 SkASSERT(!iterB.done()); 1606 SkASSERT(!iterB.done());
1607 int topB = iterB.top(); 1607 int topB = iterB.top();
1608 int botB = iterB.bottom(); 1608 int botB = iterB.bottom();
1609 1609
1610 do { 1610 do {
1611 const uint8_t* rowA = NULL; 1611 const uint8_t* rowA = nullptr;
1612 const uint8_t* rowB = NULL; 1612 const uint8_t* rowB = nullptr;
1613 int top, bot; 1613 int top, bot;
1614 1614
1615 if (topA < topB) { 1615 if (topA < topB) {
1616 top = topA; 1616 top = topA;
1617 rowA = iterA.data(); 1617 rowA = iterA.data();
1618 if (botA <= topB) { 1618 if (botA <= topB) {
1619 bot = botA; 1619 bot = botA;
1620 } else { 1620 } else {
1621 bot = topA = topB; 1621 bot = topA = topB;
1622 } 1622 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 return this->op(*this, clip, op); 1796 return this->op(*this, clip, op);
1797 } 1797 }
1798 1798
1799 bool SkAAClip::op(const SkAAClip& clip, SkRegion::Op op) { 1799 bool SkAAClip::op(const SkAAClip& clip, SkRegion::Op op) {
1800 return this->op(*this, clip, op); 1800 return this->op(*this, clip, op);
1801 } 1801 }
1802 1802
1803 /////////////////////////////////////////////////////////////////////////////// 1803 ///////////////////////////////////////////////////////////////////////////////
1804 1804
1805 bool SkAAClip::translate(int dx, int dy, SkAAClip* dst) const { 1805 bool SkAAClip::translate(int dx, int dy, SkAAClip* dst) const {
1806 if (NULL == dst) { 1806 if (nullptr == dst) {
1807 return !this->isEmpty(); 1807 return !this->isEmpty();
1808 } 1808 }
1809 1809
1810 if (this->isEmpty()) { 1810 if (this->isEmpty()) {
1811 return dst->setEmpty(); 1811 return dst->setEmpty();
1812 } 1812 }
1813 1813
1814 if (this != dst) { 1814 if (this != dst) {
1815 sk_atomic_inc(&fRunHead->fRefCnt); 1815 sk_atomic_inc(&fRunHead->fRefCnt);
1816 dst->freeRuns(); 1816 dst->freeRuns();
(...skipping 15 matching lines...) Expand all
1832 row += 2; 1832 row += 2;
1833 width -= n; 1833 width -= n;
1834 } 1834 }
1835 SkASSERT(0 == width); 1835 SkASSERT(0 == width);
1836 } 1836 }
1837 1837
1838 void SkAAClip::copyToMask(SkMask* mask) const { 1838 void SkAAClip::copyToMask(SkMask* mask) const {
1839 mask->fFormat = SkMask::kA8_Format; 1839 mask->fFormat = SkMask::kA8_Format;
1840 if (this->isEmpty()) { 1840 if (this->isEmpty()) {
1841 mask->fBounds.setEmpty(); 1841 mask->fBounds.setEmpty();
1842 mask->fImage = NULL; 1842 mask->fImage = nullptr;
1843 mask->fRowBytes = 0; 1843 mask->fRowBytes = 0;
1844 return; 1844 return;
1845 } 1845 }
1846 1846
1847 mask->fBounds = fBounds; 1847 mask->fBounds = fBounds;
1848 mask->fRowBytes = fBounds.width(); 1848 mask->fRowBytes = fBounds.width();
1849 size_t size = mask->computeImageSize(); 1849 size_t size = mask->computeImageSize();
1850 mask->fImage = SkMask::AllocImage(size); 1850 mask->fImage = SkMask::AllocImage(size);
1851 1851
1852 Iter iter(*this); 1852 Iter iter(*this);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 n = data[0]; 1891 n = data[0];
1892 } 1892 }
1893 runs[0] = 0; // sentinel 1893 runs[0] = 0; // sentinel
1894 } 1894 }
1895 1895
1896 SkAAClipBlitter::~SkAAClipBlitter() { 1896 SkAAClipBlitter::~SkAAClipBlitter() {
1897 sk_free(fScanlineScratch); 1897 sk_free(fScanlineScratch);
1898 } 1898 }
1899 1899
1900 void SkAAClipBlitter::ensureRunsAndAA() { 1900 void SkAAClipBlitter::ensureRunsAndAA() {
1901 if (NULL == fScanlineScratch) { 1901 if (nullptr == fScanlineScratch) {
1902 // add 1 so we can store the terminating run count of 0 1902 // add 1 so we can store the terminating run count of 0
1903 int count = fAAClipBounds.width() + 1; 1903 int count = fAAClipBounds.width() + 1;
1904 // we use this either for fRuns + fAA, or a scaline of a mask 1904 // we use this either for fRuns + fAA, or a scaline of a mask
1905 // which may be as deep as 32bits 1905 // which may be as deep as 32bits
1906 fScanlineScratch = sk_malloc_throw(count * sizeof(SkPMColor)); 1906 fScanlineScratch = sk_malloc_throw(count * sizeof(SkPMColor));
1907 fRuns = (int16_t*)fScanlineScratch; 1907 fRuns = (int16_t*)fScanlineScratch;
1908 fAA = (SkAlpha*)(fRuns + count); 1908 fAA = (SkAlpha*)(fRuns + count);
1909 } 1909 }
1910 } 1910 }
1911 1911
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 SkASSERT(rowN == n); 2085 SkASSERT(rowN == n);
2086 row += 2; 2086 row += 2;
2087 rowN = row[0]; 2087 rowN = row[0];
2088 } 2088 }
2089 } 2089 }
2090 2090
2091 static MergeAAProc find_merge_aa_proc(SkMask::Format format) { 2091 static MergeAAProc find_merge_aa_proc(SkMask::Format format) {
2092 switch (format) { 2092 switch (format) {
2093 case SkMask::kBW_Format: 2093 case SkMask::kBW_Format:
2094 SkDEBUGFAIL("unsupported"); 2094 SkDEBUGFAIL("unsupported");
2095 return NULL; 2095 return nullptr;
2096 case SkMask::kA8_Format: 2096 case SkMask::kA8_Format:
2097 case SkMask::k3D_Format: { 2097 case SkMask::k3D_Format: {
2098 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;
2099 return (MergeAAProc)proc8; 2099 return (MergeAAProc)proc8;
2100 } 2100 }
2101 case SkMask::kLCD16_Format: { 2101 case SkMask::kLCD16_Format: {
2102 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;
2103 return (MergeAAProc)proc16; 2103 return (MergeAAProc)proc16;
2104 } 2104 }
2105 default: 2105 default:
2106 SkDEBUGFAIL("unsupported"); 2106 SkDEBUGFAIL("unsupported");
2107 return NULL; 2107 return nullptr;
2108 } 2108 }
2109 } 2109 }
2110 2110
2111 static U8CPU bit2byte(int bitInAByte) { 2111 static U8CPU bit2byte(int bitInAByte) {
2112 SkASSERT(bitInAByte <= 0xFF); 2112 SkASSERT(bitInAByte <= 0xFF);
2113 // 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
2114 // some value >= 8 to get a full FF value 2114 // some value >= 8 to get a full FF value
2115 return -bitInAByte >> 8; 2115 return -bitInAByte >> 8;
2116 } 2116 }
2117 2117
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 2161
2162 if (fAAClip->quickContains(clip)) { 2162 if (fAAClip->quickContains(clip)) {
2163 fBlitter->blitMask(origMask, clip); 2163 fBlitter->blitMask(origMask, clip);
2164 return; 2164 return;
2165 } 2165 }
2166 2166
2167 const SkMask* mask = &origMask; 2167 const SkMask* mask = &origMask;
2168 2168
2169 // if we're BW, we need to upscale to A8 (ugh) 2169 // if we're BW, we need to upscale to A8 (ugh)
2170 SkMask grayMask; 2170 SkMask grayMask;
2171 grayMask.fImage = NULL; 2171 grayMask.fImage = nullptr;
2172 if (SkMask::kBW_Format == origMask.fFormat) { 2172 if (SkMask::kBW_Format == origMask.fFormat) {
2173 grayMask.fFormat = SkMask::kA8_Format; 2173 grayMask.fFormat = SkMask::kA8_Format;
2174 grayMask.fBounds = origMask.fBounds; 2174 grayMask.fBounds = origMask.fBounds;
2175 grayMask.fRowBytes = origMask.fBounds.width(); 2175 grayMask.fRowBytes = origMask.fBounds.width();
2176 size_t size = grayMask.computeImageSize(); 2176 size_t size = grayMask.computeImageSize();
2177 grayMask.fImage = (uint8_t*)fGrayMaskScratch.reset(size, 2177 grayMask.fImage = (uint8_t*)fGrayMaskScratch.reset(size,
2178 SkAutoMalloc::kReuse_OnShrink); 2178 SkAutoMalloc::kReuse_OnShrink);
2179 2179
2180 upscaleBW2A8(&grayMask, origMask); 2180 upscaleBW2A8(&grayMask, origMask);
2181 mask = &grayMask; 2181 mask = &grayMask;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 mergeProc(src, width, row, initialCount, rowMask.fImage); 2213 mergeProc(src, width, row, initialCount, rowMask.fImage);
2214 rowMask.fBounds.fTop = y; 2214 rowMask.fBounds.fTop = y;
2215 rowMask.fBounds.fBottom = y + 1; 2215 rowMask.fBounds.fBottom = y + 1;
2216 fBlitter->blitMask(rowMask, rowMask.fBounds); 2216 fBlitter->blitMask(rowMask, rowMask.fBounds);
2217 src = (const void*)((const char*)src + srcRB); 2217 src = (const void*)((const char*)src + srcRB);
2218 } while (++y < localStopY); 2218 } while (++y < localStopY);
2219 } while (y < stopY); 2219 } while (y < stopY);
2220 } 2220 }
2221 2221
2222 const SkPixmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { 2222 const SkPixmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) {
2223 return NULL; 2223 return nullptr;
2224 } 2224 }
OLDNEW
« no previous file with comments | « src/core/SkAAClip.h ('k') | src/core/SkAdvancedTypefaceMetrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698