Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 987f4e53 authored by Tenghui Zhu's avatar Tenghui Zhu Committed by Android (Google) Code Review
Browse files

Merge "Recreate the bitmap cache when it is smaller than needed" into nyc-mr2-dev

parents ae91d106 17f40b80
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -576,7 +576,7 @@ bool Tree::allocateBitmapIfNeeded(SkBitmap* outCache, int width, int height) {
}

bool Tree::canReuseBitmap(const SkBitmap& bitmap, int width, int height) {
    return width == bitmap.width() && height == bitmap.height();
    return width <= bitmap.width() && height <= bitmap.height();
}

void Tree::onPropertyChanged(TreeProperties* prop) {
+9 −4
Original line number Diff line number Diff line
@@ -622,10 +622,15 @@ public:
        }

        void setScaledSize(int width, int height) {
            if (mNonAnimatableProperties.scaledWidth != width
                    || mNonAnimatableProperties.scaledHeight != height) {
                mNonAnimatableProperties.scaledWidth = width;
                mNonAnimatableProperties.scaledHeight = height;
            // If the requested size is bigger than what the bitmap was, then
            // we increase the bitmap size to match. The width and height
            // are bound by MAX_CACHED_BITMAP_SIZE.
            if (mNonAnimatableProperties.scaledWidth < width
                    || mNonAnimatableProperties.scaledHeight < height) {
                mNonAnimatableProperties.scaledWidth = std::max(width,
                        mNonAnimatableProperties.scaledWidth);
                mNonAnimatableProperties.scaledHeight = std::max(height,
                        mNonAnimatableProperties.scaledHeight);
                mNonAnimatablePropertiesDirty = true;
                mTree->onPropertyChanged(this);
            }