1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "src/gpu/ops/BlurOp.h" 17 18#include "src/gpu/GrOpFlushState.h" 19#include "src/gpu/GrOpsRenderPass.h" 20 21namespace skgpu::v1 { 22 23BlurOp::BlurOp(GrSurfaceProxyView proxyView, const SkBlurArg& blurArg) 24 : GrOp(ClassID()), 25 fProxyView(proxyView), 26 skBlurArg(blurArg) 27{ 28 this->setBounds(skBlurArg.srcRect, HasAABloat::kNo, IsHairline::kNo); 29} 30 31GrOp::CombineResult BlurOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) 32{ 33 return CombineResult::kCannotCombine; 34} 35 36void BlurOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) 37{ 38 SkASSERT(state->opsRenderPass()); 39 state->opsRenderPass()->drawBlurImage(fProxyView, skBlurArg); 40} 41 42} // namespace skgpu::v1 43