Home | History | Annotate | Download | only in sksg
      1 /*
      2  * Copyright 2017 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 #include "SkSGInvalidationController.h"
      9 
     10 #include "SkRect.h"
     11 #include "SkTLazy.h"
     12 
     13 namespace sksg {
     14 
     15 InvalidationController::InvalidationController() : fBounds(SkRect::MakeEmpty()) {}
     16 
     17 void InvalidationController::inval(const SkRect& r, const SkMatrix& ctm) {
     18     if (r.isEmpty()) {
     19         return;
     20     }
     21 
     22     SkTCopyOnFirstWrite<SkRect> rect(r);
     23 
     24     if (!ctm.isIdentity()) {
     25         ctm.mapRect(rect.writable());
     26     }
     27 
     28     fRects.push(*rect);
     29     fBounds.join(*rect);
     30 }
     31 
     32 } // namespace sksg
     33