Files
Nolan Scobie 572d801cca [HWUI] Update Ganesh includes to specify new location
Upstream Skia changes I7269acfae5c26518c2a61930a8af9584682751cd and
Ibc927d0ae66a05546957300090a651614e720fad are moving Ganesh headers into
Skia's include/gpu/ganesh/ directory. Android's current includes are
relying on temporary shims which will soon be removed.

Note: I also sorted some includes to try and calm the chaos a tiny bit,
but didn't go out of my way to update all non-Ganesh Skia includes.

clang-format decided to further re-arrange things, so I'm hoping this
doesn't make future merge conflicts too painful.

Bug: 40044159
Test: builds after locally deleting Skia's temporary shims
Flag: EXEMPT refactor
Change-Id: I5099e215a58915a5e6c7b3434f9855006dda8c60
2024-08-30 13:54:14 -04:00

64 lines
1.8 KiB
C++

/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <SkSurface.h>
#include <effects/StretchEffect.h>
#include <include/gpu/ganesh/GrRecordingContext.h>
#include "SkiaDisplayList.h"
namespace android::uirenderer {
/**
* Helper class used to create/cache an SkSurface instance
* to create a mask that is used to draw a stretched hole punch
*/
class StretchMask {
public:
/**
* Release the current surface used for the stretch mask
*/
void clear() {
mMaskSurface = nullptr;
}
/**
* Reset the dirty flag to re-create the stretch mask on the next draw
* pass
*/
void markDirty() {
mIsDirty = true;
}
/**
* Draws the stretch mask into the given target canvas
* @param context GrRecordingContext used to create the surface if necessary
* @param stretch StretchEffect to apply to the mask
* @param bounds Target bounds to draw into the given canvas
* @param displayList List of drawing commands to render into the stretch mask
* @param canvas Target canvas to draw the mask into
*/
void draw(GrRecordingContext* context,
const StretchEffect& stretch, const SkRect& bounds,
skiapipeline::SkiaDisplayList* displayList, SkCanvas* canvas);
private:
sk_sp<SkSurface> mMaskSurface;
bool mIsDirty = true;
};
}