gfx/skia/trunk/src/animator/SkBoundable.cpp

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial