michael@0: michael@0: /* michael@0: * Copyright 2006 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #include "SkDrawTo.h" michael@0: #include "SkAnimateMaker.h" michael@0: #include "SkCanvas.h" michael@0: #include "SkDrawBitmap.h" michael@0: michael@0: #if SK_USE_CONDENSED_INFO == 0 michael@0: michael@0: const SkMemberInfo SkDrawTo::fInfo[] = { michael@0: SK_MEMBER(drawOnce, Boolean), michael@0: SK_MEMBER(use, Bitmap) michael@0: }; michael@0: michael@0: #endif michael@0: michael@0: DEFINE_GET_MEMBER(SkDrawTo); michael@0: michael@0: SkDrawTo::SkDrawTo() : drawOnce(false), use(NULL), fDrawnOnce(false) { michael@0: } michael@0: michael@0: #if 0 michael@0: SkDrawTo::~SkDrawTo() { michael@0: SkASSERT(0); michael@0: } michael@0: #endif michael@0: michael@0: bool SkDrawTo::draw(SkAnimateMaker& maker) { michael@0: if (fDrawnOnce) michael@0: return false; michael@0: SkCanvas canvas(use->fBitmap); michael@0: SkCanvas* save = maker.fCanvas; michael@0: maker.fCanvas = &canvas; michael@0: INHERITED::draw(maker); michael@0: maker.fCanvas = save; michael@0: fDrawnOnce = drawOnce; michael@0: return false; michael@0: } michael@0: michael@0: #ifdef SK_DUMP_ENABLED michael@0: void SkDrawTo::dump(SkAnimateMaker* maker) { michael@0: dumpBase(maker); michael@0: dumpAttrs(maker); michael@0: if (use) michael@0: SkDebugf("use=\"%s\" ", use->id); michael@0: dumpDrawables(maker); michael@0: } michael@0: #endif