blob: e784e9f6d0e1f3b46da941952c1e4c63f1eda879 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#include "SkBoundable.h"
11#include "SkAnimateMaker.h"
12#include "SkCanvas.h"
13
14SkBoundable::SkBoundable() {
15 clearBounds();
16 fBounds.fTop = 0;
17 fBounds.fRight = 0;
18 fBounds.fBottom = 0;
19}
20
21void SkBoundable::clearBounder() {
22 fBounds.fLeft = 0x7fff;
23}
24
25void 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
37void SkBoundable::enableBounder() {
38 fBounds.fLeft = 0;
39}
40
41
rmistry@google.comd6176b02012-08-23 18:14:13 +000042SkBoundableAuto::SkBoundableAuto(SkBoundable* boundable,
reed@android.com8a1c16f2008-12-17 15:59:43 +000043 SkAnimateMaker& maker) : fBoundable(boundable), fMaker(maker) {
44 if (fBoundable->hasBounds()) {
reed868074b2014-06-03 10:53:59 -070045// fMaker.fCanvas->setBounder(&maker.fDisplayList);
reed@android.com8a1c16f2008-12-17 15:59:43 +000046 fMaker.fDisplayList.fBounds.setEmpty();
47 }
48}
49
50SkBoundableAuto::~SkBoundableAuto() {
51 if (fBoundable->hasBounds() == false)
52 return;
halcanary96fcdcc2015-08-27 07:41:13 -070053// fMaker.fCanvas->setBounder(nullptr);
reed@android.com8a1c16f2008-12-17 15:59:43 +000054 fBoundable->setBounds(fMaker.fDisplayList.fBounds);
55}