Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: include/effects/SkLayerRasterizer.h

Issue 1821533002: guard rasterizer and drawlooper setters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update android sdk Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef SkLayerRasterizer_DEFINED 8 #ifndef SkLayerRasterizer_DEFINED
11 #define SkLayerRasterizer_DEFINED 9 #define SkLayerRasterizer_DEFINED
12 10
13 #include "SkRasterizer.h" 11 #include "SkRasterizer.h"
14 #include "SkDeque.h" 12 #include "SkDeque.h"
15 #include "SkScalar.h" 13 #include "SkScalar.h"
16 14
17 class SkPaint; 15 class SkPaint;
18 16
19 class SK_API SkLayerRasterizer : public SkRasterizer { 17 class SK_API SkLayerRasterizer : public SkRasterizer {
(...skipping 17 matching lines...) Expand all
37 */ 35 */
38 void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy); 36 void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy);
39 37
40 /** 38 /**
41 * Pass queue of layers on to newly created layer rasterizer and retur n it. The builder 39 * Pass queue of layers on to newly created layer rasterizer and retur n it. The builder
42 * *cannot* be used any more after calling this function. If no layers have been added, 40 * *cannot* be used any more after calling this function. If no layers have been added,
43 * returns NULL. 41 * returns NULL.
44 * 42 *
45 * The caller is responsible for calling unref() on the returned objec t, if non NULL. 43 * The caller is responsible for calling unref() on the returned objec t, if non NULL.
46 */ 44 */
47 SkLayerRasterizer* detachRasterizer(); 45 sk_sp<SkLayerRasterizer> detach();
48 46
49 /** 47 /**
50 * Create and return a new immutable SkLayerRasterizer that contains a shapshot of the 48 * Create and return a new immutable SkLayerRasterizer that contains a shapshot of the
51 * layers that were added to the Builder, without modifying the Builde r. The Builder 49 * layers that were added to the Builder, without modifying the Builde r. The Builder
52 * *may* be used after calling this function. It will continue to hold any layers 50 * *may* be used after calling this function. It will continue to hold any layers
53 * previously added, so consecutive calls to this function will return identical objects, 51 * previously added, so consecutive calls to this function will return identical objects,
54 * and objects returned by future calls to this function contain all t he layers in 52 * and objects returned by future calls to this function contain all t he layers in
55 * previously returned objects. If no layers have been added, returns NULL. 53 * previously returned objects. If no layers have been added, returns NULL.
56 * 54 *
57 * Future calls to addLayer will not affect rasterizers previously ret urned by this call. 55 * Future calls to addLayer will not affect rasterizers previously ret urned by this call.
58 * 56 *
59 * The caller is responsible for calling unref() on the returned objec t, if non NULL. 57 * The caller is responsible for calling unref() on the returned objec t, if non NULL.
60 */ 58 */
61 SkLayerRasterizer* snapshotRasterizer() const; 59 sk_sp<SkLayerRasterizer> snapshot() const;
60
61 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR
62 SkLayerRasterizer* detachRasterizer() {
63 return this->detach().release();
64 }
65 SkLayerRasterizer* snapshotRasterizer() const {
66 return this->snapshot().release();
67 }
68 #endif
62 69
63 private: 70 private:
64 SkDeque* fLayers; 71 SkDeque* fLayers;
65 }; 72 };
66 73
67 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer) 74 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer)
68 75
69 protected: 76 protected:
70 SkLayerRasterizer(); 77 SkLayerRasterizer();
71 SkLayerRasterizer(SkDeque* layers); 78 SkLayerRasterizer(SkDeque* layers);
72 void flatten(SkWriteBuffer&) const override; 79 void flatten(SkWriteBuffer&) const override;
73 80
74 // override from SkRasterizer 81 // override from SkRasterizer
75 virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, 82 virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix,
76 const SkIRect* clipBounds, 83 const SkIRect* clipBounds,
77 SkMask* mask, SkMask::CreateMode mode) const overri de; 84 SkMask* mask, SkMask::CreateMode mode) const overri de;
78 85
79 private: 86 private:
80 const SkDeque* const fLayers; 87 const SkDeque* const fLayers;
81 88
82 static SkDeque* ReadLayers(SkReadBuffer& buffer); 89 static SkDeque* ReadLayers(SkReadBuffer& buffer);
83 90
84 friend class LayerRasterizerTester; 91 friend class LayerRasterizerTester;
85 92
86 typedef SkRasterizer INHERITED; 93 typedef SkRasterizer INHERITED;
87 }; 94 };
88 95
89 #endif 96 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698