Home | History | Annotate | Download | only in utils
      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.
     17 class SK_API SkNoSaveLayerCanvas : public SkCanvas {
     18 public:
     19     SkNoSaveLayerCanvas(SkBaseDevice* device)
     20         : INHERITED(device, kConservativeRasterClip_InitFlag)
     21     {}
     22 
     23 protected:
     24     SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override {
     25         (void)this->INHERITED::getSaveLayerStrategy(rec);
     26         return kNoLayer_SaveLayerStrategy;
     27     }
     28 
     29 private:
     30     typedef SkCanvas INHERITED;
     31 };
     32 
     33 #endif // SkNoSaveLayerCanvas_DEFINED
     34