| // Copyright 2020 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| package org.chromium.components.paintpreview.player.frame; |
| |
| import android.graphics.Bitmap; |
| import android.graphics.Matrix; |
| import android.graphics.Rect; |
| |
| /** |
| * API of the PlayerFrameMediator to helper classes. |
| */ |
| public interface PlayerFrameMediatorDelegate { |
| /** |
| * Triggers an update of the visual contents of the PlayerFrameView. This fetches updates the |
| * model and fetches any new bitmaps asynchronously. |
| * @param scaleChanged Indicates that the scale changed so all current bitmaps need to be |
| * discarded. |
| */ |
| void updateVisuals(boolean scaleChanged); |
| |
| /** |
| * Updates the visibility and size of subframes. |
| * @param viewportRect The viewport rect to use for computing visibility. |
| * @param scaleFactor The scale factor at which to compute visibility. |
| */ |
| void updateSubframes(Rect viewportRect, float scaleFactor); |
| |
| /** |
| * Sets the bitmap scale matrix and recursively sets the bitmap scale matrix of children |
| * ignoring the translation portion of the transform. Also updates subframe visibility of |
| * nested subframes. |
| * @param bitmapScaleMatrix The bitmap scale matrix to use for the currently loaded bitmaps. |
| * @param scaleFactor The scale factor to use when computing nested subframe visibility. |
| */ |
| void setBitmapScaleMatrix(Matrix bitmapScaleMatrix, float scaleFactor); |
| |
| /** |
| * Resets the scale factor of subframes. This allows a new initial scale factor to be used for |
| * subframes when fetching bitmaps at the new scale. |
| */ |
| void resetScaleFactorOfAllSubframes(); |
| |
| /** |
| * Forcibly redraws the currently visible subframes. This prevents issues where a subframe won't |
| * redraw when scaling is finished if its layout size didn't change. |
| */ |
| void forceRedrawVisibleSubframes(); |
| |
| /** |
| * Updates the bitmap matrix in the model. |
| */ |
| void updateBitmapMatrix(Bitmap[][] bitmapMatrix); |
| } |