skia2/modules/sksg/include/SkSGInvalidationController.h
Florin Malita 00d4f535c9 [skottie] Expose SG inval controller on seek()
- shift the revalidation phase from Scene::render() to Scene::animate()
 - pass an optional inval controller to Scene::animate() and Animation::seek()
 - hoist the showInval logic out of SkSG, into clients

This allows clients to track dirty regions and detect cases where no updates are needed.

Bug: skia:9267
Change-Id: I3d35bf58b6eee9bfeb6e127ba58e2b96713b772d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229001
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-07-22 16:33:15 +00:00

46 lines
1.1 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSGInvalidationController_DEFINED
#define SkSGInvalidationController_DEFINED
#include "include/core/SkMatrix.h"
#include "include/core/SkTypes.h"
#include "include/private/SkTDArray.h"
struct SkRect;
namespace sksg {
/**
* Receiver for invalidation events.
*
* Tracks dirty regions for repaint.
*/
class InvalidationController {
public:
InvalidationController();
InvalidationController(const InvalidationController&) = delete;
InvalidationController& operator=(const InvalidationController&) = delete;
void inval(const SkRect&, const SkMatrix& ctm = SkMatrix::I());
const SkRect& bounds() const { return fBounds; }
const SkRect* begin() const { return fRects.begin(); }
const SkRect* end() const { return fRects.end(); }
void reset();
private:
SkTDArray<SkRect> fRects;
SkRect fBounds;
};
} // namespace sksg
#endif // SkSGInvalidationController_DEFINED