| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkCanvasStateUtils.h" | 8 #include "SkCanvasStateUtils.h" |
| 9 | 9 |
| 10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 * clipped out of its interior) without needing to malloc any additional mem
ory. | 156 * clipped out of its interior) without needing to malloc any additional mem
ory. |
| 157 */ | 157 */ |
| 158 SkSWriter32<4*sizeof(ClipRect)> clipWriter; | 158 SkSWriter32<4*sizeof(ClipRect)> clipWriter; |
| 159 | 159 |
| 160 if (!clip.isEmpty()) { | 160 if (!clip.isEmpty()) { |
| 161 // only returns the b/w clip so aa clips fail | 161 // only returns the b/w clip so aa clips fail |
| 162 SkRegion::Iterator clip_iterator(clip); | 162 SkRegion::Iterator clip_iterator(clip); |
| 163 for (; !clip_iterator.done(); clip_iterator.next()) { | 163 for (; !clip_iterator.done(); clip_iterator.next()) { |
| 164 // this assumes the SkIRect is stored in l,t,r,b ordering which | 164 // this assumes the SkIRect is stored in l,t,r,b ordering which |
| 165 // matches the ordering of our ClipRect struct | 165 // matches the ordering of our ClipRect struct |
| 166 clipWriter.writeIRect(clip_iterator.rect()); | 166 clipWriter.writeT<SkIRect>(clip_iterator.rect()); |
| 167 state->clipRectCount++; | 167 state->clipRectCount++; |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 // allocate memory for the clip then and copy them to the struct | 171 // allocate memory for the clip then and copy them to the struct |
| 172 state->clipRects = (ClipRect*) sk_malloc_throw(clipWriter.bytesWritten()); | 172 state->clipRects = (ClipRect*) sk_malloc_throw(clipWriter.bytesWritten()); |
| 173 clipWriter.flatten(state->clipRects); | 173 clipWriter.flatten(state->clipRects); |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 330 } |
| 331 | 331 |
| 332 return canvas.detach(); | 332 return canvas.detach(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 //////////////////////////////////////////////////////////////////////////////// | 335 //////////////////////////////////////////////////////////////////////////////// |
| 336 | 336 |
| 337 void SkCanvasStateUtils::ReleaseCanvasState(SkCanvasState* state) { | 337 void SkCanvasStateUtils::ReleaseCanvasState(SkCanvasState* state) { |
| 338 SkDELETE(state); | 338 SkDELETE(state); |
| 339 } | 339 } |
| OLD | NEW |