robertphillips@google.com | 81e8739 | 2014-01-07 16:08:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkNoSaveLayerCanvas_DEFINED |
| 9 | #define SkNoSaveLayerCanvas_DEFINED |
| 10 | |
| 11 | #include "SkCanvas.h" |
| 12 | #include "SkRRect.h" |
| 13 | |
| 14 | // The NoSaveLayerCanvas is used to play back SkPictures when the saveLayer |
| 15 | // functionality isn't required (e.g., during analysis of the draw calls). |
| 16 | // It also simplifies the clipping calls to only use rectangles. |
robertphillips@google.com | 0f03f43 | 2014-03-16 21:59:11 +0000 | [diff] [blame] | 17 | class SK_API SkNoSaveLayerCanvas : public SkCanvas { |
robertphillips@google.com | 81e8739 | 2014-01-07 16:08:04 +0000 | [diff] [blame] | 18 | public: |
reed | 4a8126e | 2014-09-22 07:29:03 -0700 | [diff] [blame] | 19 | SkNoSaveLayerCanvas(SkBaseDevice* device) |
| 20 | : INHERITED(device, NULL, kConservativeRasterClip_InitFlag) |
reed | d954498 | 2014-09-09 18:46:22 -0700 | [diff] [blame] | 21 | {} |
robertphillips@google.com | 81e8739 | 2014-01-07 16:08:04 +0000 | [diff] [blame] | 22 | |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 23 | protected: |
| 24 | virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame^] | 25 | SaveFlags flags) override { |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 26 | this->INHERITED::willSaveLayer(bounds, paint, flags); |
| 27 | return kNoLayer_SaveLayerStrategy; |
robertphillips@google.com | 81e8739 | 2014-01-07 16:08:04 +0000 | [diff] [blame] | 28 | } |
| 29 | |
robertphillips@google.com | 81e8739 | 2014-01-07 16:08:04 +0000 | [diff] [blame] | 30 | private: |
| 31 | typedef SkCanvas INHERITED; |
| 32 | }; |
| 33 | |
| 34 | #endif // SkNoSaveLayerCanvas_DEFINED |