| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 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 | 9 |
| 10 #include "SkRegionPriv.h" | 10 #include "SkRegionPriv.h" |
| 11 #include "SkBlitter.h" | 11 #include "SkBlitter.h" |
| 12 #include "SkScan.h" | 12 #include "SkScan.h" |
| 13 #include "SkTDArray.h" | 13 #include "SkTDArray.h" |
| 14 #include "SkPath.h" | 14 #include "SkPath.h" |
| 15 | 15 |
| 16 class SkRgnBuilder : public SkBlitter { | 16 class SkRgnBuilder : public SkBlitter { |
| 17 public: | 17 public: |
| 18 SkRgnBuilder(); |
| 18 virtual ~SkRgnBuilder(); | 19 virtual ~SkRgnBuilder(); |
| 19 | 20 |
| 20 // returns true if it could allocate the working storage needed | 21 // returns true if it could allocate the working storage needed |
| 21 bool init(int maxHeight, int maxTransitions, bool pathIsInverse); | 22 bool init(int maxHeight, int maxTransitions, bool pathIsInverse); |
| 22 | 23 |
| 23 void done() { | 24 void done() { |
| 24 if (fCurrScanline != NULL) { | 25 if (fCurrScanline != NULL) { |
| 25 fCurrScanline->fXCount = (SkRegion::RunType)((int)(fCurrXPtr - fCurr
Scanline->firstX())); | 26 fCurrScanline->fXCount = (SkRegion::RunType)((int)(fCurrXPtr - fCurr
Scanline->firstX())); |
| 26 if (!this->collapsWithPrev()) { // flush the last line | 27 if (!this->collapsWithPrev()) { // flush the last line |
| 27 fCurrScanline = fCurrScanline->nextScanline(); | 28 fCurrScanline = fCurrScanline->nextScanline(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 fCurrScanline->fXCount * sizeof(SkRegion::RunType))) | 92 fCurrScanline->fXCount * sizeof(SkRegion::RunType))) |
| 92 { | 93 { |
| 93 // update the height of fPrevScanline | 94 // update the height of fPrevScanline |
| 94 fPrevScanline->fLastY = fCurrScanline->fLastY; | 95 fPrevScanline->fLastY = fCurrScanline->fLastY; |
| 95 return true; | 96 return true; |
| 96 } | 97 } |
| 97 return false; | 98 return false; |
| 98 } | 99 } |
| 99 }; | 100 }; |
| 100 | 101 |
| 102 SkRgnBuilder::SkRgnBuilder() |
| 103 : fStorage(NULL) { |
| 104 } |
| 105 |
| 101 SkRgnBuilder::~SkRgnBuilder() { | 106 SkRgnBuilder::~SkRgnBuilder() { |
| 102 sk_free(fStorage); | 107 sk_free(fStorage); |
| 103 } | 108 } |
| 104 | 109 |
| 105 bool SkRgnBuilder::init(int maxHeight, int maxTransitions, bool pathIsInverse) { | 110 bool SkRgnBuilder::init(int maxHeight, int maxTransitions, bool pathIsInverse) { |
| 106 if ((maxHeight | maxTransitions) < 0) { | 111 if ((maxHeight | maxTransitions) < 0) { |
| 107 return false; | 112 return false; |
| 108 } | 113 } |
| 109 | 114 |
| 110 Sk64 count, size; | 115 Sk64 count, size; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 #endif | 513 #endif |
| 509 | 514 |
| 510 path->incReserve(count << 1); | 515 path->incReserve(count << 1); |
| 511 do { | 516 do { |
| 512 SkASSERT(count > 1); | 517 SkASSERT(count > 1); |
| 513 count -= extract_path(start, stop, path); | 518 count -= extract_path(start, stop, path); |
| 514 } while (count > 0); | 519 } while (count > 0); |
| 515 | 520 |
| 516 return true; | 521 return true; |
| 517 } | 522 } |
| OLD | NEW |