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 "SkLayerRasterizer.h" | 10 #include "SkLayerRasterizer.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 rec->fPaint.~SkPaint(); | 43 rec->fPaint.~SkPaint(); |
44 | 44 |
45 SkDELETE(layers); | 45 SkDELETE(layers); |
46 } | 46 } |
47 | 47 |
48 SkLayerRasterizer::~SkLayerRasterizer() { | 48 SkLayerRasterizer::~SkLayerRasterizer() { |
49 SkASSERT(fLayers); | 49 SkASSERT(fLayers); |
50 clean_up_layers(const_cast<SkDeque*>(fLayers)); | 50 clean_up_layers(const_cast<SkDeque*>(fLayers)); |
51 } | 51 } |
52 | 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 | |
64 static bool compute_bounds(const SkDeque& layers, const SkPath& path, | 53 static bool compute_bounds(const SkDeque& layers, const SkPath& path, |
65 const SkMatrix& matrix, | 54 const SkMatrix& matrix, |
66 const SkIRect* clipBounds, SkIRect* bounds) { | 55 const SkIRect* clipBounds, SkIRect* bounds) { |
67 SkDeque::F2BIter iter(layers); | 56 SkDeque::F2BIter iter(layers); |
68 SkLayerRasterizer_Rec* rec; | 57 SkLayerRasterizer_Rec* rec; |
69 | 58 |
70 bounds->set(SK_MaxS32, SK_MaxS32, SK_MinS32, SK_MinS32); | 59 bounds->set(SK_MaxS32, SK_MaxS32, SK_MinS32, SK_MinS32); |
71 | 60 |
72 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) { | 61 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) { |
73 const SkPaint& paint = rec->fPaint; | 62 const SkPaint& paint = rec->fPaint; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 SkDEBUGCODE(count++); | 225 SkDEBUGCODE(count++); |
237 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); | 226 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); |
238 SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint)); | 227 SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint)); |
239 recCopy->fOffset = recOrig->fOffset; | 228 recCopy->fOffset = recOrig->fOffset; |
240 } | 229 } |
241 SkASSERT(fLayers->count() == count); | 230 SkASSERT(fLayers->count() == count); |
242 SkASSERT(layers->count() == count); | 231 SkASSERT(layers->count() == count); |
243 SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers)); | 232 SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers)); |
244 return rasterizer; | 233 return rasterizer; |
245 } | 234 } |
OLD | NEW |