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 "SkScanPriv.h" | 10 #include "SkScanPriv.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 /// Run-length-encoded supersampling antialiased blitter. | 103 /// Run-length-encoded supersampling antialiased blitter. |
104 class SuperBlitter : public BaseSuperBlitter { | 104 class SuperBlitter : public BaseSuperBlitter { |
105 public: | 105 public: |
106 SuperBlitter(SkBlitter* realBlitter, const SkIRect& ir, | 106 SuperBlitter(SkBlitter* realBlitter, const SkIRect& ir, |
107 const SkRegion& clip); | 107 const SkRegion& clip); |
108 | 108 |
109 virtual ~SuperBlitter() { | 109 virtual ~SuperBlitter() { |
110 this->flush(); | 110 this->flush(); |
111 sk_free(fRunsBuffer); | |
112 } | 111 } |
113 | 112 |
114 /// Once fRuns contains a complete supersampled row, flush() blits | 113 /// Once fRuns contains a complete supersampled row, flush() blits |
115 /// it out through the wrapped blitter. | 114 /// it out through the wrapped blitter. |
116 void flush(); | 115 void flush(); |
117 | 116 |
118 /// Blits a row of pixels, with location and width specified | 117 /// Blits a row of pixels, with location and width specified |
119 /// in supersampled coordinates. | 118 /// in supersampled coordinates. |
120 virtual void blitH(int x, int y, int width) SK_OVERRIDE; | 119 virtual void blitH(int x, int y, int width) SK_OVERRIDE; |
121 /// Blits a rectangle of pixels, with location and size specified | 120 /// Blits a rectangle of pixels, with location and size specified |
(...skipping 25 matching lines...) Expand all Loading... |
147 fRuns.reset(fWidth); | 146 fRuns.reset(fWidth); |
148 } | 147 } |
149 | 148 |
150 int fOffsetX; | 149 int fOffsetX; |
151 }; | 150 }; |
152 | 151 |
153 SuperBlitter::SuperBlitter(SkBlitter* realBlitter, const SkIRect& ir, | 152 SuperBlitter::SuperBlitter(SkBlitter* realBlitter, const SkIRect& ir, |
154 const SkRegion& clip) | 153 const SkRegion& clip) |
155 : BaseSuperBlitter(realBlitter, ir, clip) { | 154 : BaseSuperBlitter(realBlitter, ir, clip) { |
156 fRunsToBuffer = realBlitter->requestRowsPreserved(); | 155 fRunsToBuffer = realBlitter->requestRowsPreserved(); |
157 fRunsBuffer = sk_malloc_throw(fRunsToBuffer * this->getRunsSz()); | 156 fRunsBuffer = realBlitter->allocBlitMemory(fRunsToBuffer * this->getRunsSz()
); |
158 fCurrentRun = -1; | 157 fCurrentRun = -1; |
159 | 158 |
160 this->advanceRuns(); | 159 this->advanceRuns(); |
161 | 160 |
162 fOffsetX = 0; | 161 fOffsetX = 0; |
163 } | 162 } |
164 | 163 |
165 void SuperBlitter::flush() { | 164 void SuperBlitter::flush() { |
166 if (fCurrIY >= fTop) { | 165 if (fCurrIY >= fTop) { |
167 | 166 |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 AntiFillPath(path, clip.bwRgn(), blitter); | 756 AntiFillPath(path, clip.bwRgn(), blitter); |
758 } else { | 757 } else { |
759 SkRegion tmp; | 758 SkRegion tmp; |
760 SkAAClipBlitter aaBlitter; | 759 SkAAClipBlitter aaBlitter; |
761 | 760 |
762 tmp.setRect(clip.getBounds()); | 761 tmp.setRect(clip.getBounds()); |
763 aaBlitter.init(blitter, &clip.aaRgn()); | 762 aaBlitter.init(blitter, &clip.aaRgn()); |
764 SkScan::AntiFillPath(path, tmp, &aaBlitter, true); | 763 SkScan::AntiFillPath(path, tmp, &aaBlitter, true); |
765 } | 764 } |
766 } | 765 } |
OLD | NEW |