Remove obsolete SkRecording.
Can land after https://codereview.chromium.org/664583002/ does. BUG=skia: Only API removed. TBR=reed@google.com Review URL: https://codereview.chromium.org/660903002
This commit is contained in:
parent
93b255b19e
commit
a71aee6afd
@ -151,7 +151,6 @@
|
||||
'<(skia_src_path)/core/SkRecordDraw.cpp',
|
||||
'<(skia_src_path)/core/SkRecordOpts.cpp',
|
||||
'<(skia_src_path)/core/SkRecorder.cpp',
|
||||
'<(skia_src_path)/core/SkRecording.cpp',
|
||||
'<(skia_src_path)/core/SkRect.cpp',
|
||||
'<(skia_src_path)/core/SkRefDict.cpp',
|
||||
'<(skia_src_path)/core/SkRegion.cpp',
|
||||
|
@ -171,7 +171,6 @@
|
||||
'../tests/RecordPatternTest.cpp',
|
||||
'../tests/RecordTest.cpp',
|
||||
'../tests/RecorderTest.cpp',
|
||||
'../tests/RecordingTest.cpp',
|
||||
'../tests/RecordingXfermodeTest.cpp',
|
||||
'../tests/RefCntTest.cpp',
|
||||
'../tests/RefDictTest.cpp',
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef SkRecording_DEFINED
|
||||
#define SkRecording_DEFINED
|
||||
|
||||
#include "SkCanvas.h" // SkCanvas
|
||||
#include "SkRefCnt.h" // SkAutoTUnref
|
||||
#include "SkTemplates.h" // SkAutoTDelete
|
||||
#include "SkTypes.h" // SkNoncopyable
|
||||
|
||||
// These are intentionally left opaque.
|
||||
class SkRecord;
|
||||
class SkRecorder;
|
||||
|
||||
namespace EXPERIMENTAL {
|
||||
|
||||
/** Easy mode interface to SkRecord-based SkCanvas recording.
|
||||
*
|
||||
* scoped_ptr<SkRecording> recording(new SkRecording(1920, 1080));
|
||||
* skia::RefPtr<SkCanvas> canvas(skia::SharePtr(recording->canvas()));
|
||||
*
|
||||
* canvas->drawThis();
|
||||
* canvas->clipThat();
|
||||
* ...
|
||||
*
|
||||
* canvas.clear(); // You must deref the canvas before you may call releasePlayback().
|
||||
* scoped_ptr<const SkPlayback> playback(recording->releasePlayback());
|
||||
* playback->draw(&someCanvas);
|
||||
* playback->draw(&someOtherCanvas);
|
||||
*
|
||||
* SkPlayback is thread safe; SkRecording is not.
|
||||
*/
|
||||
|
||||
class SK_API SkPlayback : SkNoncopyable {
|
||||
public:
|
||||
// Remember, if you've got an SkPlayback*, you probably own it. Don't forget to delete it!
|
||||
~SkPlayback();
|
||||
|
||||
// Draw recorded commands into a canvas.
|
||||
void draw(SkCanvas*) const;
|
||||
|
||||
private:
|
||||
explicit SkPlayback(const SkRecord*);
|
||||
|
||||
SkAutoTDelete<const SkRecord> fRecord;
|
||||
|
||||
friend class SkRecording;
|
||||
};
|
||||
|
||||
class SK_API SkRecording : SkNoncopyable {
|
||||
public:
|
||||
SkRecording(int width, int height);
|
||||
~SkRecording();
|
||||
|
||||
// Draws issued to this canvas will be replayed by SkPlayback::draw().
|
||||
// Any refs held on canvas() must be dropped before you may call releasePlayback().
|
||||
SkCanvas* canvas();
|
||||
|
||||
// Release exclusive ownership of an SkPlayback to the caller.
|
||||
// Any refs held on canvas() must be dropped before you may call releasePlayback().
|
||||
SkPlayback* releasePlayback();
|
||||
|
||||
private:
|
||||
SkAutoTDelete<SkRecord> fRecord;
|
||||
SkAutoTUnref<SkRecorder> fRecorder;
|
||||
};
|
||||
|
||||
} // namespace EXPERIMENTAL
|
||||
|
||||
#endif//SkRecording_DEFINED
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "../../include/record/SkRecording.h"
|
||||
|
||||
#include "SkRecord.h"
|
||||
#include "SkRecordOpts.h"
|
||||
#include "SkRecordDraw.h"
|
||||
#include "SkRecorder.h"
|
||||
|
||||
namespace EXPERIMENTAL {
|
||||
|
||||
SkPlayback::SkPlayback(const SkRecord* record) : fRecord(record) {}
|
||||
|
||||
SkPlayback::~SkPlayback() {}
|
||||
|
||||
void SkPlayback::draw(SkCanvas* canvas) const {
|
||||
SkASSERT(fRecord.get() != NULL);
|
||||
SkRecordDraw(*fRecord, canvas, NULL/*bbh*/, NULL/*callback*/);
|
||||
}
|
||||
|
||||
SkRecording::SkRecording(int width, int height)
|
||||
: fRecord(SkNEW(SkRecord))
|
||||
, fRecorder(SkNEW_ARGS(SkRecorder, (fRecord.get(), width, height)))
|
||||
{}
|
||||
|
||||
SkPlayback* SkRecording::releasePlayback() {
|
||||
SkASSERT(fRecorder->unique());
|
||||
fRecorder->forgetRecord();
|
||||
SkRecordOptimize(fRecord.get());
|
||||
return SkNEW_ARGS(SkPlayback, (fRecord.detach()));
|
||||
}
|
||||
|
||||
SkRecording::~SkRecording() {}
|
||||
|
||||
SkCanvas* SkRecording::canvas() {
|
||||
return fRecord.get() ? fRecorder.get() : NULL;
|
||||
}
|
||||
|
||||
} // namespace EXPERIMENTAL
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "Test.h"
|
||||
|
||||
#include "../include/record/SkRecording.h"
|
||||
|
||||
// Minimally exercise the public SkRecording API.
|
||||
|
||||
DEF_TEST(SkRecording, r) {
|
||||
EXPERIMENTAL::SkRecording recording(1920, 1080);
|
||||
|
||||
// Some very exciting commands here.
|
||||
recording.canvas()->clipRect(SkRect::MakeWH(320, 240));
|
||||
|
||||
SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlayback());
|
||||
|
||||
SkCanvas target;
|
||||
playback->draw(&target);
|
||||
|
||||
// Here's another recording we never call releasePlayback().
|
||||
// However pointless, this should be safe.
|
||||
EXPERIMENTAL::SkRecording pointless(1920, 1080);
|
||||
pointless.canvas()->clipRect(SkRect::MakeWH(320, 240));
|
||||
}
|
@ -11,7 +11,6 @@
|
||||
#include "../include/core/SkPicture.h"
|
||||
#include "../include/core/SkStream.h"
|
||||
#include "../include/core/SkString.h"
|
||||
#include "../include/record/SkRecording.h"
|
||||
#include "../include/core/SkPictureRecorder.h"
|
||||
#include <cstring>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user