diff options
| author | 2018-04-13 10:21:26 -0400 | |
|---|---|---|
| committer | 2018-04-30 20:22:19 +0000 | |
| commit | 4f901c8cec76780264021167210f90dcbe6f0d03 (patch) | |
| tree | a8ccd832f3b40de7d826379e039a5d505a695c59 /libs | |
| parent | 331a22e39a95e335da6f401aa4caee8efb3781de (diff) | |
Invoke create_recording_canvas correctly in macro bench tests
create_recording_canvas expects as a last parameter a render node,
which is used to reuse deallocated display lists. Passing the
render node improved performance in several tests and it is
matching how HWUI is using that API too.
bug: 69131471
Test: tvappGlTex DrawFrame is 1ms faster
Change-Id: I93d8da694c178d3fb8d1aa52afa76dd8271e93cb
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/hwui/tests/common/TestListViewSceneBase.cpp | 3 | ||||
| -rw-r--r-- | libs/hwui/tests/common/TestUtils.h | 3 | ||||
| -rw-r--r-- | libs/hwui/tests/common/scenes/GlyphStressAnimation.cpp | 3 | ||||
| -rw-r--r-- | libs/hwui/tests/common/scenes/TvApp.cpp | 9 |
4 files changed, 12 insertions, 6 deletions
diff --git a/libs/hwui/tests/common/TestListViewSceneBase.cpp b/libs/hwui/tests/common/TestListViewSceneBase.cpp index a7f4d4d3991f..fd331333d38a 100644 --- a/libs/hwui/tests/common/TestListViewSceneBase.cpp +++ b/libs/hwui/tests/common/TestListViewSceneBase.cpp @@ -57,7 +57,8 @@ void TestListViewSceneBase::doFrame(int frameNr) { int pxOffset = -(scrollPx % (mItemSpacing + mItemHeight)); std::unique_ptr<Canvas> canvas(Canvas::create_recording_canvas( - mListView->stagingProperties().getWidth(), mListView->stagingProperties().getHeight())); + mListView->stagingProperties().getWidth(), mListView->stagingProperties().getHeight(), + mListView.get())); for (size_t ci = 0; ci < mListItems.size(); ci++) { // update item position auto listItem = mListItems[(ci + itemIndexOffset) % mListItems.size()]; diff --git a/libs/hwui/tests/common/TestUtils.h b/libs/hwui/tests/common/TestUtils.h index 1bfa046eff63..2752ae9a8036 100644 --- a/libs/hwui/tests/common/TestUtils.h +++ b/libs/hwui/tests/common/TestUtils.h @@ -250,7 +250,8 @@ public: static void recordNode(RenderNode& node, std::function<void(Canvas&)> contentCallback) { std::unique_ptr<Canvas> canvas(Canvas::create_recording_canvas( - node.stagingProperties().getWidth(), node.stagingProperties().getHeight())); + node.stagingProperties().getWidth(), node.stagingProperties().getHeight(), + &node)); contentCallback(*canvas.get()); node.setStagingDisplayList(canvas->finishRecording()); } diff --git a/libs/hwui/tests/common/scenes/GlyphStressAnimation.cpp b/libs/hwui/tests/common/scenes/GlyphStressAnimation.cpp index 38999cb1d2ec..f0a5e9dff1b9 100644 --- a/libs/hwui/tests/common/scenes/GlyphStressAnimation.cpp +++ b/libs/hwui/tests/common/scenes/GlyphStressAnimation.cpp @@ -44,7 +44,8 @@ public: std::unique_ptr<Canvas> canvas( Canvas::create_recording_canvas(container->stagingProperties().getWidth(), - container->stagingProperties().getHeight())); + container->stagingProperties().getHeight(), + container.get())); Paint paint; paint.setAntiAlias(true); diff --git a/libs/hwui/tests/common/scenes/TvApp.cpp b/libs/hwui/tests/common/scenes/TvApp.cpp index 003d8e92fd9f..a64e8444a9b1 100644 --- a/libs/hwui/tests/common/scenes/TvApp.cpp +++ b/libs/hwui/tests/common/scenes/TvApp.cpp @@ -194,7 +194,8 @@ private: // re-recording card's canvas, not necessary but to add some burden to CPU std::unique_ptr<Canvas> cardcanvas(Canvas::create_recording_canvas( - card->stagingProperties().getWidth(), card->stagingProperties().getHeight())); + card->stagingProperties().getWidth(), card->stagingProperties().getHeight(), + card.get())); sp<RenderNode> image = mImages[ci]; sp<RenderNode> infoArea = mInfoAreas[ci]; cardcanvas->drawRenderNode(infoArea.get()); @@ -205,14 +206,16 @@ private: sp<RenderNode> overlay = mOverlays[ci]; std::unique_ptr<Canvas> canvas( Canvas::create_recording_canvas(overlay->stagingProperties().getWidth(), - overlay->stagingProperties().getHeight())); + overlay->stagingProperties().getHeight(), + overlay.get())); canvas->drawColor((curFrame % 150) << 24, SkBlendMode::kSrcOver); overlay->setStagingDisplayList(canvas->finishRecording()); cardcanvas->drawRenderNode(overlay.get()); } else { // re-recording image node's canvas, animating ColorFilter std::unique_ptr<Canvas> canvas(Canvas::create_recording_canvas( - image->stagingProperties().getWidth(), image->stagingProperties().getHeight())); + image->stagingProperties().getWidth(), image->stagingProperties().getHeight(), + image.get())); SkPaint paint; sk_sp<SkColorFilter> filter( SkColorFilter::MakeModeFilter((curFrame % 150) << 24, SkBlendMode::kSrcATop)); |