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