blob: 65cd4a83291e50a8d5ff3cda35e976beb1d01f61 [file] [log] [blame]
robertphillips@google.com81e87392014-01-07 16:08:04 +00001/*
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.com0f03f432014-03-16 21:59:11 +000017class SK_API SkNoSaveLayerCanvas : public SkCanvas {
robertphillips@google.com81e87392014-01-07 16:08:04 +000018public:
reed4a8126e2014-09-22 07:29:03 -070019 SkNoSaveLayerCanvas(SkBaseDevice* device)
20 : INHERITED(device, NULL, kConservativeRasterClip_InitFlag)
reedd9544982014-09-09 18:46:22 -070021 {}
robertphillips@google.com81e87392014-01-07 16:08:04 +000022
commit-bot@chromium.orge54a23f2014-03-12 20:21:48 +000023protected:
24 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint,
mtklein36352bf2015-03-25 18:17:31 -070025 SaveFlags flags) override {
commit-bot@chromium.orge54a23f2014-03-12 20:21:48 +000026 this->INHERITED::willSaveLayer(bounds, paint, flags);
27 return kNoLayer_SaveLayerStrategy;
robertphillips@google.com81e87392014-01-07 16:08:04 +000028 }
29
robertphillips@google.com81e87392014-01-07 16:08:04 +000030private:
31 typedef SkCanvas INHERITED;
32};
33
34#endif // SkNoSaveLayerCanvas_DEFINED