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

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

Issue 233673002: Create SkLayerRasterizer w/o destroying Builder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Better comments. New function is now const, and has a better name. Created 6 years, 8 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 | « gyp/tests.gypi ('k') | 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.
43 *
44 * The caller is responsible for calling unref() on the returned objec t.
43 */ 45 */
44 SkLayerRasterizer* detachRasterizer(); 46 SkLayerRasterizer* detachRasterizer();
45 47
48 /**
49 * 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 * *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 * and objects returned by future calls to this function contain all t he layers in
54 * previously returned objects.
55 *
56 * Future calls to addLayer will not affect rasterizers previously ret urned by this call.
57 *
58 * The caller is responsible for calling unref() on the returned objec t.
59 */
60 SkLayerRasterizer* snapshotRasterizer() const;
reed1 2014/04/10 20:16:42 can this guy be const? Does it have to be? I'd be
scroggo 2014/04/10 20:21:37 As stated in person, it can, but does not have to
61
46 private: 62 private:
47 SkDeque* fLayers; 63 SkDeque* fLayers;
48 }; 64 };
49 65
50 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API 66 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API
51 void addLayer(const SkPaint& paint) { 67 void addLayer(const SkPaint& paint) {
52 this->addLayer(paint, 0, 0); 68 this->addLayer(paint, 0, 0);
53 } 69 }
54 70
55 /** Add a new layer (above any previous layers) to the rasterizer. 71 /** Add a new layer (above any previous layers) to the rasterizer.
(...skipping 23 matching lines...) Expand all
79 95
80 private: 96 private:
81 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API 97 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API
82 SkDeque* fLayers; 98 SkDeque* fLayers;
83 #else 99 #else
84 const SkDeque* const fLayers; 100 const SkDeque* const fLayers;
85 #endif 101 #endif
86 102
87 static SkDeque* ReadLayers(SkReadBuffer& buffer); 103 static SkDeque* ReadLayers(SkReadBuffer& buffer);
88 104
105 friend class LayerRasterizerTester;
106
89 typedef SkRasterizer INHERITED; 107 typedef SkRasterizer INHERITED;
90 }; 108 };
91 109
92 #endif 110 #endif
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | src/effects/SkLayerRasterizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698