• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright 2006 The Android Open Source Project
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 
10 #include "SkBoundable.h"
11 #include "SkAnimateMaker.h"
12 #include "SkCanvas.h"
13 
SkBoundable()14 SkBoundable::SkBoundable() {
15     clearBounds();
16     fBounds.fTop = 0;
17     fBounds.fRight = 0;
18     fBounds.fBottom = 0;
19 }
20 
clearBounder()21 void SkBoundable::clearBounder() {
22     fBounds.fLeft = 0x7fff;
23 }
24 
getBounds(SkRect * rect)25 void SkBoundable::getBounds(SkRect* rect) {
26     SkASSERT(rect);
27     if (fBounds.fLeft == (int16_t)0x8000U) {
28         INHERITED::getBounds(rect);
29         return;
30     }
31     rect->fLeft = SkIntToScalar(fBounds.fLeft);
32     rect->fTop = SkIntToScalar(fBounds.fTop);
33     rect->fRight = SkIntToScalar(fBounds.fRight);
34     rect->fBottom = SkIntToScalar(fBounds.fBottom);
35 }
36 
enableBounder()37 void SkBoundable::enableBounder() {
38     fBounds.fLeft = 0;
39 }
40 
41 
SkBoundableAuto(SkBoundable * boundable,SkAnimateMaker & maker)42 SkBoundableAuto::SkBoundableAuto(SkBoundable* boundable,
43         SkAnimateMaker& maker) : fBoundable(boundable), fMaker(maker) {
44     if (fBoundable->hasBounds()) {
45 //        fMaker.fCanvas->setBounder(&maker.fDisplayList);
46         fMaker.fDisplayList.fBounds.setEmpty();
47     }
48 }
49 
~SkBoundableAuto()50 SkBoundableAuto::~SkBoundableAuto() {
51     if (fBoundable->hasBounds() == false)
52         return;
53 //    fMaker.fCanvas->setBounder(nullptr);
54     fBoundable->setBounds(fMaker.fDisplayList.fBounds);
55 }
56