/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifdef SK_BUILD_FOR_ANDROID
#include "SkPicturePlayback.h"
#endif
#include "SkPictureRecorder.h"

SkCanvas* SkPictureRecorder::beginRecording(int width, int height,
                                            SkBBHFactory* bbhFactory /* = NULL */,
                                            uint32_t recordFlags /* = 0 */) {
    fPicture.reset(SkNEW(SkPicture));
    return fPicture->beginRecording(width, height, bbhFactory, recordFlags);
}

#ifdef SK_BUILD_FOR_ANDROID
void SkPictureRecorder::partialReplay(SkCanvas* canvas) {
    if (NULL == fPicture.get() || NULL == canvas) {
        // Not recording or nothing to replay into
        return;
    }

    SkASSERT(NULL != fPicture->fRecord);

    SkAutoTDelete<SkPicturePlayback> playback(SkPicture::FakeEndRecording(fPicture,
                                                                          *fPicture->fRecord,
                                                                          false));
    playback->draw(*canvas, NULL);
}
#endif

/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

// Need to include SkTypes first, so that SK_BUILD_FOR_ANDROID is defined.
#include "SkTypes.h"
#ifdef SK_BUILD_FOR_ANDROID
#include "SkPicturePlayback.h"
#endif
#include "SkPictureRecorder.h"

SkCanvas* SkPictureRecorder::beginRecording(int width, int height,
                                            SkBBHFactory* bbhFactory /* = NULL */,
                                            uint32_t recordFlags /* = 0 */) {
    fPicture.reset(SkNEW(SkPicture));
    return fPicture->beginRecording(width, height, bbhFactory, recordFlags);
}

#ifdef SK_BUILD_FOR_ANDROID
void SkPictureRecorder::partialReplay(SkCanvas* canvas) {
    if (NULL == fPicture.get() || NULL == canvas) {
        // Not recording or nothing to replay into
        return;
    }

    SkASSERT(NULL != fPicture->fRecord);

    SkAutoTDelete<SkPicturePlayback> playback(SkPicture::FakeEndRecording(fPicture,
                                                                          *fPicture->fRecord,
                                                                          false));
    playback->draw(*canvas, NULL);
}
#endif

Include SkTypes to fix Android frameworks build
Include SkTypes to fix Android frameworks build

Since Android's defines are included in SkUserConfig (rather than
being defined in the build file), we need to include something that
includes SkUserConfig (transitively; meaning just about anything)
before we can use any build macros. Include SkTypes, "the correct
way to get access to the config system" so that
SK_BUILD_FOR_ANDROID is defined before querying it.

R=robertphillips@google.com, djsollen@google.com, mtklein@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/294393011

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@14914 2bbb7eff-a529-9590-31e7-b0007b416f81
