diff options
author | ztenghui <ztenghui@google.com> | 2017-09-13 10:32:50 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2017-09-14 15:56:50 -0700 |
commit | cf0c41dbc221c2619212c7e25e6d90a9c4d05b05 (patch) | |
tree | 46b9526090b931ed2a74472dea2568e9cef7d909 /libs/hwui/VectorDrawable.cpp | |
parent | 6d17e6586e77e1f2409df469c2c4ddfeb64e2369 (diff) |
Add systrace for VectorDrawable inflation and draw
We didn't trace the draw from cache.
Here we add trace for draw into bitmap, which is normally heavy.
fix: 65060698
Test: run test app and get systrace and check
Change-Id: Ia81127c4aa285b3277e9c9edbdf356d85cb28b5e
Diffstat (limited to 'libs/hwui/VectorDrawable.cpp')
-rw-r--r-- | libs/hwui/VectorDrawable.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/hwui/VectorDrawable.cpp b/libs/hwui/VectorDrawable.cpp index e0373cae9923..376371de80dc 100644 --- a/libs/hwui/VectorDrawable.cpp +++ b/libs/hwui/VectorDrawable.cpp @@ -22,6 +22,7 @@ #include "SkShader.h" #include <utils/Log.h> #include "utils/Macros.h" +#include "utils/TraceUtils.h" #include "utils/VectorDrawableUtils.h" #include <math.h> @@ -580,14 +581,17 @@ void Tree::draw(SkCanvas* canvas) { void Tree::updateBitmapCache(Bitmap& bitmap, bool useStagingData) { SkBitmap outCache; bitmap.getSkBitmap(&outCache); + int cacheWidth = outCache.width(); + int cacheHeight = outCache.height(); + ATRACE_FORMAT("VectorDrawable repaint %dx%d", cacheWidth, cacheHeight); outCache.eraseColor(SK_ColorTRANSPARENT); SkCanvas outCanvas(outCache); float viewportWidth = useStagingData ? mStagingProperties.getViewportWidth() : mProperties.getViewportWidth(); float viewportHeight = useStagingData ? mStagingProperties.getViewportHeight() : mProperties.getViewportHeight(); - float scaleX = outCache.width() / viewportWidth; - float scaleY = outCache.height() / viewportHeight; + float scaleX = cacheWidth / viewportWidth; + float scaleY = cacheHeight / viewportHeight; outCanvas.scale(scaleX, scaleY); mRootNode->draw(&outCanvas, useStagingData); } |