Clean up unused SkPictureRecorder::optimizeFor()
Don't worry about the failing Shield bot... unrelated experiment. It's failing at head. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2340133002 NOTREECHECKS=true Review-Url: https://codereview.chromium.org/2340133002
This commit is contained in:
parent
14e7a602d0
commit
c518a76105
@ -112,9 +112,6 @@ public:
|
||||
SkPicture* SK_WARN_UNUSED_RESULT endRecording() { return this->endRecordingAsPicture(); }
|
||||
#endif
|
||||
|
||||
// Strawman API.
|
||||
void optimizeFor(GrContext* ctx) { fGrContextToOptimizeFor = ctx; }
|
||||
|
||||
private:
|
||||
void reset();
|
||||
|
||||
@ -135,8 +132,6 @@ private:
|
||||
SkAutoTUnref<SkRecord> fRecord;
|
||||
SkMiniRecorder fMiniRecorder;
|
||||
|
||||
GrContext* fGrContextToOptimizeFor = nullptr;
|
||||
|
||||
typedef SkNoncopyable INHERITED;
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "SkBigPicture.h"
|
||||
#include "SkData.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkImage.h"
|
||||
#include "SkPictureRecorder.h"
|
||||
#include "SkPictureUtils.h"
|
||||
#include "SkRecord.h"
|
||||
@ -17,54 +16,6 @@
|
||||
#include "SkRecordedDrawable.h"
|
||||
#include "SkRecorder.h"
|
||||
#include "SkTypes.h"
|
||||
#include "SkTLogic.h"
|
||||
|
||||
namespace SkRecords {
|
||||
|
||||
struct OptimizeFor {
|
||||
GrContext* fCtx;
|
||||
|
||||
// A few ops have a top-level SkImage:
|
||||
void operator()(DrawAtlas* op) { this->make_texture(&op->atlas); }
|
||||
void operator()(DrawImage* op) { this->make_texture(&op->image); }
|
||||
void operator()(DrawImageNine* op) { this->make_texture(&op->image); }
|
||||
void operator()(DrawImageRect* op) { this->make_texture(&op->image); }
|
||||
void make_texture(sk_sp<const SkImage>* img) const {
|
||||
*img = (*img)->makeTextureImage(fCtx);
|
||||
}
|
||||
|
||||
// Some ops have a paint, some have an optional paint.
|
||||
// Either way, get back a pointer.
|
||||
static SkPaint* AsPtr(SkPaint& p) { return &p; }
|
||||
static SkPaint* AsPtr(SkRecords::Optional<SkPaint>& p) { return p; }
|
||||
|
||||
// For all other types of ops, look for images inside the paint.
|
||||
template <typename T>
|
||||
SK_WHEN(T::kTags & kHasPaint_Tag, void) operator()(T* op) {
|
||||
SkMatrix matrix;
|
||||
SkShader::TileMode xy[2];
|
||||
|
||||
if (auto paint = AsPtr(op->paint))
|
||||
if (auto shader = paint->getShader())
|
||||
if (auto image = shader->isAImage(&matrix, xy)) {
|
||||
paint->setShader(image->makeTextureImage(fCtx)->makeShader(xy[0], xy[1], &matrix));
|
||||
}
|
||||
|
||||
// TODO: re-build compose shaders
|
||||
}
|
||||
|
||||
// Control ops, etc. Nothing to do for these.
|
||||
template <typename T>
|
||||
SK_WHEN(!(T::kTags & kHasPaint_Tag), void) operator()(T*) {}
|
||||
};
|
||||
|
||||
} // namespace SkRecords
|
||||
|
||||
static void optimize_for(GrContext* ctx, SkRecord* record) {
|
||||
for (int i = 0; ctx && i < record->count(); i++) {
|
||||
record->mutate(i, SkRecords::OptimizeFor{ctx});
|
||||
}
|
||||
}
|
||||
|
||||
SkPictureRecorder::SkPictureRecorder() {
|
||||
fActivelyRecording = false;
|
||||
@ -112,7 +63,6 @@ sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPicture(uint32_t finishFlag
|
||||
|
||||
// TODO: delay as much of this work until just before first playback?
|
||||
SkRecordOptimize(fRecord);
|
||||
optimize_for(fGrContextToOptimizeFor, fRecord);
|
||||
|
||||
if (fRecord->count() == 0) {
|
||||
if (finishFlags & kReturnNullForEmpty_FinishFlag) {
|
||||
@ -173,7 +123,6 @@ sk_sp<SkDrawable> SkPictureRecorder::finishRecordingAsDrawable(uint32_t finishFl
|
||||
fRecorder->restoreToCount(1); // If we were missing any restores, add them now.
|
||||
|
||||
SkRecordOptimize(fRecord);
|
||||
optimize_for(fGrContextToOptimizeFor, fRecord);
|
||||
|
||||
if (fRecord->count() == 0) {
|
||||
if (finishFlags & kReturnNullForEmpty_FinishFlag) {
|
||||
|
Loading…
Reference in New Issue
Block a user