Chromium Code Reviews| Index: src/core/SkPictureRangePlayback.h |
| diff --git a/src/core/SkPictureRangePlayback.h b/src/core/SkPictureRangePlayback.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1da55aa693b4018266b13f0a543ae420ab975eeb |
| --- /dev/null |
| +++ b/src/core/SkPictureRangePlayback.h |
| @@ -0,0 +1,46 @@ |
| +/* |
| + * Copyright 2014 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#ifndef SkPictureRangePlayback_DEFINED |
| +#define SkPictureRangePlayback_DEFINED |
| + |
| +#include "SkPicturePlayback.h" |
| + |
| +// This version of picture playback plays all the operations between |
| +// a pair of start and stop values. |
| +// The opcode at 'start' should be a saveLayer while the opcode at |
| +// 'stop' should be a restore. Neither of those commands will be issued. |
| +// Since this class never uses the bounding box hierarchy, the base class' |
| +// useBBH setting is ignored. |
| +class SkPictureRangePlayback : public SkPicturePlayback { |
| +public: |
| + SkPictureRangePlayback(const SkPicture* picture) |
| + : INHERITED(picture) |
| + , fStart(0) |
| + , fStop(0) { |
| + } |
| + |
| + virtual void draw(SkCanvas* canvas, SkDrawPictureCallback*) SK_OVERRIDE; |
| + |
| + // Limit the opcode playback to be between the offsets 'start' and 'stop'. |
| + // Set both start & stop to 0 to disable draw limiting. Note that disabling |
| + // draw limiting isn't the same as using the base SkPicturePlayback object |
| + // since this class never uses the bounding box hierarchy information. |
| + void setDrawLimits(size_t start, size_t stop) { |
|
mtklein
2014/07/08 14:31:57
As used, looks like you can eliminate this and set
robertphillips
2014/07/08 14:38:33
Done.
|
| + fStart = start; |
| + fStop = stop; |
| + } |
| + |
| +private: |
| + size_t fStart; |
| + size_t fStop; |
| + |
| + typedef SkPicturePlayback INHERITED; |
| +}; |
| + |
| + |
| +#endif |