180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2006 The Android Open Source Project
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkDisplayBounds.h"
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkAnimateMaker.h"
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if SK_USE_CONDENSED_INFO == 0
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruconst SkMemberInfo SkDisplayBounds::fInfo[] = {
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SK_MEMBER_INHERITED,
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SK_MEMBER(inval, Boolean)
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruDEFINE_GET_MEMBER(SkDisplayBounds);
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkDisplayBounds::SkDisplayBounds() : inval(false) {
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querubool SkDisplayBounds::draw(SkAnimateMaker& maker) {
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    maker.fDisplayList.fUnionBounds = SkToBool(inval);
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    maker.fDisplayList.fDrawBounds = false;
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    fBounds.setEmpty();
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool result = INHERITED::draw(maker);
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    maker.fDisplayList.fUnionBounds = false;
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    maker.fDisplayList.fDrawBounds = true;
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    if (inval && fBounds.isEmpty() == false) {
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkIRect& rect = maker.fDisplayList.fInvalBounds;
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        maker.fDisplayList.fHasUnion = true;
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (rect.isEmpty())
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            rect = fBounds;
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        else
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            rect.join(fBounds);
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    return result;
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
44