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

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

Issue 313653006: Return NULL when building empty LayerRasterizer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | src/effects/SkLayerRasterizer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef SkLayerRasterizer_DEFINED 10 #ifndef SkLayerRasterizer_DEFINED
(...skipping 21 matching lines...) Expand all
32 /** 32 /**
33 * Add a new layer (above any previous layers) to the rasterizer. 33 * Add a new layer (above any previous layers) to the rasterizer.
34 * The layer will extract those fields that affect the mask from 34 * The layer will extract those fields that affect the mask from
35 * the specified paint, but will not retain a reference to the paint 35 * the specified paint, but will not retain a reference to the paint
36 * object itself, so it may be reused without danger of side-effects. 36 * object itself, so it may be reused without danger of side-effects.
37 */ 37 */
38 void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy); 38 void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy);
39 39
40 /** 40 /**
41 * Pass queue of layers on to newly created layer rasterizer and retur n it. The builder 41 * 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. 42 * *cannot* be used any more after calling this function. If no layers have been added,
43 * returns NULL.
43 * 44 *
44 * The caller is responsible for calling unref() on the returned objec t. 45 * The caller is responsible for calling unref() on the returned objec t, if non NULL.
45 */ 46 */
46 SkLayerRasterizer* detachRasterizer(); 47 SkLayerRasterizer* detachRasterizer();
47 48
48 /** 49 /**
49 * Create and return a new immutable SkLayerRasterizer that contains a shapshot of the 50 * Create and return a new immutable SkLayerRasterizer that contains a shapshot of the
50 * layers that were added to the Builder, without modifying the Builde r. The Builder 51 * layers that were added to the Builder, without modifying the Builde r. The Builder
51 * *may* be used after calling this function. It will continue to hold any layers 52 * *may* be used after calling this function. It will continue to hold any layers
52 * previously added, so consecutive calls to this function will return identical objects, 53 * previously added, so consecutive calls to this function will return identical objects,
53 * and objects returned by future calls to this function contain all t he layers in 54 * and objects returned by future calls to this function contain all t he layers in
54 * previously returned objects. 55 * previously returned objects. If no layers have been added, returns NULL.
55 * 56 *
56 * Future calls to addLayer will not affect rasterizers previously ret urned by this call. 57 * Future calls to addLayer will not affect rasterizers previously ret urned by this call.
57 * 58 *
58 * The caller is responsible for calling unref() on the returned objec t. 59 * The caller is responsible for calling unref() on the returned objec t, if non NULL.
59 */ 60 */
60 SkLayerRasterizer* snapshotRasterizer() const; 61 SkLayerRasterizer* snapshotRasterizer() const;
61 62
62 private: 63 private:
63 SkDeque* fLayers; 64 SkDeque* fLayers;
64 }; 65 };
65 66
66 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API 67 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API
67 void addLayer(const SkPaint& paint) { 68 void addLayer(const SkPaint& paint) {
68 this->addLayer(paint, 0, 0); 69 this->addLayer(paint, 0, 0);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 #endif 102 #endif
102 103
103 static SkDeque* ReadLayers(SkReadBuffer& buffer); 104 static SkDeque* ReadLayers(SkReadBuffer& buffer);
104 105
105 friend class LayerRasterizerTester; 106 friend class LayerRasterizerTester;
106 107
107 typedef SkRasterizer INHERITED; 108 typedef SkRasterizer INHERITED;
108 }; 109 };
109 110
110 #endif 111 #endif
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkLayerRasterizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698