OLD | NEW |
| 1 |
1 /* | 2 /* |
2 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
3 * | 4 * |
4 * 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 |
5 * found in the LICENSE file. | 6 * found in the LICENSE file. |
6 */ | 7 */ |
7 | 8 |
| 9 |
8 #include "SkLayerRasterizer.h" | 10 #include "SkLayerRasterizer.h" |
9 #include "SkDraw.h" | 11 #include "SkDraw.h" |
10 #include "SkReadBuffer.h" | 12 #include "SkReadBuffer.h" |
11 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" |
12 #include "SkMask.h" | 14 #include "SkMask.h" |
13 #include "SkMaskFilter.h" | 15 #include "SkMaskFilter.h" |
14 #include "SkPaint.h" | 16 #include "SkPaint.h" |
15 #include "SkPath.h" | 17 #include "SkPath.h" |
16 #include "SkPathEffect.h" | 18 #include "SkPathEffect.h" |
17 #include "../core/SkRasterClip.h" | 19 #include "../core/SkRasterClip.h" |
(...skipping 23 matching lines...) Expand all Loading... |
41 rec->fPaint.~SkPaint(); | 43 rec->fPaint.~SkPaint(); |
42 | 44 |
43 SkDELETE(layers); | 45 SkDELETE(layers); |
44 } | 46 } |
45 | 47 |
46 SkLayerRasterizer::~SkLayerRasterizer() { | 48 SkLayerRasterizer::~SkLayerRasterizer() { |
47 SkASSERT(fLayers); | 49 SkASSERT(fLayers); |
48 clean_up_layers(const_cast<SkDeque*>(fLayers)); | 50 clean_up_layers(const_cast<SkDeque*>(fLayers)); |
49 } | 51 } |
50 | 52 |
| 53 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API |
| 54 void SkLayerRasterizer::addLayer(const SkPaint& paint, SkScalar dx, |
| 55 SkScalar dy) { |
| 56 SkASSERT(fLayers); |
| 57 SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)fLayers->push_back(); |
| 58 |
| 59 SkNEW_PLACEMENT_ARGS(&rec->fPaint, SkPaint, (paint)); |
| 60 rec->fOffset.set(dx, dy); |
| 61 } |
| 62 #endif |
| 63 |
51 static bool compute_bounds(const SkDeque& layers, const SkPath& path, | 64 static bool compute_bounds(const SkDeque& layers, const SkPath& path, |
52 const SkMatrix& matrix, | 65 const SkMatrix& matrix, |
53 const SkIRect* clipBounds, SkIRect* bounds) { | 66 const SkIRect* clipBounds, SkIRect* bounds) { |
54 SkDeque::F2BIter iter(layers); | 67 SkDeque::F2BIter iter(layers); |
55 SkLayerRasterizer_Rec* rec; | 68 SkLayerRasterizer_Rec* rec; |
56 | 69 |
57 bounds->set(SK_MaxS32, SK_MaxS32, SK_MinS32, SK_MinS32); | 70 bounds->set(SK_MaxS32, SK_MaxS32, SK_MinS32, SK_MinS32); |
58 | 71 |
59 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) { | 72 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) { |
60 const SkPaint& paint = rec->fPaint; | 73 const SkPaint& paint = rec->fPaint; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 SkDEBUGCODE(count++); | 236 SkDEBUGCODE(count++); |
224 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); | 237 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); |
225 SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint)); | 238 SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint)); |
226 recCopy->fOffset = recOrig->fOffset; | 239 recCopy->fOffset = recOrig->fOffset; |
227 } | 240 } |
228 SkASSERT(fLayers->count() == count); | 241 SkASSERT(fLayers->count() == count); |
229 SkASSERT(layers->count() == count); | 242 SkASSERT(layers->count() == count); |
230 SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers)); | 243 SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers)); |
231 return rasterizer; | 244 return rasterizer; |
232 } | 245 } |
OLD | NEW |