Turn on the save-layer optimization.
BUG=skia: R=robertphillips@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/551853002
This commit is contained in:
parent
95fd68e5cc
commit
93f52a6944
@ -639,18 +639,21 @@ uint32_t SkPicture::uniqueID() const {
|
|||||||
return fUniqueID;
|
return fUniqueID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SkRecord* optimized(SkRecord* r) {
|
||||||
|
SkRecordOptimize(r);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
// fRecord OK
|
// fRecord OK
|
||||||
SkPicture::SkPicture(SkScalar width, SkScalar height, SkRecord* record, SkBBoxHierarchy* bbh)
|
SkPicture::SkPicture(SkScalar width, SkScalar height, SkRecord* record, SkBBoxHierarchy* bbh)
|
||||||
: fCullWidth(width)
|
: fCullWidth(width)
|
||||||
, fCullHeight(height)
|
, fCullHeight(height)
|
||||||
, fRecord(record)
|
, fRecord(optimized(record))
|
||||||
, fBBH(SkSafeRef(bbh))
|
, fBBH(SkSafeRef(bbh))
|
||||||
, fAnalysis(*record) {
|
, fAnalysis(*fRecord) {
|
||||||
// TODO: move optimization before we construct fAnalysis?
|
|
||||||
SkRecordOptimize(record);
|
|
||||||
// TODO: delay as much of this work until just before first playback?
|
// TODO: delay as much of this work until just before first playback?
|
||||||
if (fBBH.get()) {
|
if (fBBH.get()) {
|
||||||
SkRecordFillBounds(*record, fBBH.get());
|
SkRecordFillBounds(*fRecord, fBBH.get());
|
||||||
}
|
}
|
||||||
this->needsNewGenID();
|
this->needsNewGenID();
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
using namespace SkRecords;
|
using namespace SkRecords;
|
||||||
|
|
||||||
void SkRecordOptimize(SkRecord* record) {
|
void SkRecordOptimize(SkRecord* record) {
|
||||||
// TODO(mtklein): rebaseline and re-enable
|
SkRecordNoopSaveLayerDrawRestores(record);
|
||||||
//SkRecordNoopSaveLayerDrawRestores(record);
|
|
||||||
SkRecordNoopSaveRestores(record);
|
SkRecordNoopSaveRestores(record);
|
||||||
SkRecordReduceDrawPosTextStrength(record);
|
SkRecordReduceDrawPosTextStrength(record);
|
||||||
}
|
}
|
||||||
|
@ -935,20 +935,23 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
|
|||||||
c->saveLayer(NULL, &p); // layer #3
|
c->saveLayer(NULL, &p); // layer #3
|
||||||
c->restore();
|
c->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SkPaint layerPaint;
|
||||||
|
layerPaint.setColor(SK_ColorRED); // Non-alpha only to avoid SaveLayerDrawRestoreNooper
|
||||||
// 4)
|
// 4)
|
||||||
{
|
{
|
||||||
c->saveLayer(NULL, NULL); // layer #4
|
c->saveLayer(NULL, &layerPaint); // layer #4
|
||||||
c->drawPicture(child); // layer #5 inside picture
|
c->drawPicture(child); // layer #5 inside picture
|
||||||
c->restore();
|
c->restore();
|
||||||
}
|
}
|
||||||
// 5
|
// 5
|
||||||
{
|
{
|
||||||
SkPaint p;
|
SkPaint picturePaint;
|
||||||
SkMatrix trans;
|
SkMatrix trans;
|
||||||
trans.setTranslate(10, 10);
|
trans.setTranslate(10, 10);
|
||||||
|
|
||||||
c->saveLayer(NULL, NULL); // layer #6
|
c->saveLayer(NULL, &layerPaint); // layer #6
|
||||||
c->drawPicture(child, &trans, &p); // layer #7 inside picture
|
c->drawPicture(child, &trans, &picturePaint); // layer #7 inside picture
|
||||||
c->restore();
|
c->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,7 +1035,7 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
|
|||||||
kHeight == info4.fSize.fHeight);
|
kHeight == info4.fSize.fHeight);
|
||||||
REPORTER_ASSERT(reporter, 0 == info4.fOffset.fX && 0 == info4.fOffset.fY);
|
REPORTER_ASSERT(reporter, 0 == info4.fOffset.fX && 0 == info4.fOffset.fY);
|
||||||
REPORTER_ASSERT(reporter, info4.fOriginXform.isIdentity());
|
REPORTER_ASSERT(reporter, info4.fOriginXform.isIdentity());
|
||||||
REPORTER_ASSERT(reporter, NULL == info4.fPaint);
|
REPORTER_ASSERT(reporter, info4.fPaint);
|
||||||
REPORTER_ASSERT(reporter, !info4.fIsNested &&
|
REPORTER_ASSERT(reporter, !info4.fIsNested &&
|
||||||
info4.fHasNestedLayers); // has a nested SL
|
info4.fHasNestedLayers); // has a nested SL
|
||||||
|
|
||||||
@ -1051,7 +1054,7 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
|
|||||||
kHeight == info6.fSize.fHeight);
|
kHeight == info6.fSize.fHeight);
|
||||||
REPORTER_ASSERT(reporter, 0 == info6.fOffset.fX && 0 == info6.fOffset.fY);
|
REPORTER_ASSERT(reporter, 0 == info6.fOffset.fX && 0 == info6.fOffset.fY);
|
||||||
REPORTER_ASSERT(reporter, info6.fOriginXform.isIdentity());
|
REPORTER_ASSERT(reporter, info6.fOriginXform.isIdentity());
|
||||||
REPORTER_ASSERT(reporter, NULL == info6.fPaint);
|
REPORTER_ASSERT(reporter, info6.fPaint);
|
||||||
REPORTER_ASSERT(reporter, !info6.fIsNested &&
|
REPORTER_ASSERT(reporter, !info6.fIsNested &&
|
||||||
info6.fHasNestedLayers); // has a nested SL
|
info6.fHasNestedLayers); // has a nested SL
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user