2 * Copyright (C) 2017 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 namespace uirenderer {
26 * A layer has dimensions and is backed by a VkImage.
28 class VkLayer : public Layer {
30 VkLayer(RenderState& renderState, uint32_t layerWidth, uint32_t layerHeight,
31 SkColorFilter* colorFilter, int alpha, SkBlendMode mode, bool blend)
32 : Layer(renderState, Api::Vulkan, colorFilter, alpha, mode)
34 , mHeight(layerHeight)
39 uint32_t getWidth() const override {
43 uint32_t getHeight() const override {
47 void setSize(uint32_t width, uint32_t height) override {
52 void setBlend(bool blend) override {
56 bool isBlend() const override {
60 sk_sp<SkImage> getImage() {
66 // If we've destroyed the vulkan context (VkInstance, VkDevice, etc.), we must make sure to
67 // destroy any VkImages that were made with that context.
68 void onVkContextDestroyed();
75 sk_sp<SkImage> mImage;
79 }; // namespace uirenderer
80 }; // namespace android