• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
21 namespace skgpu::v1 {
22 
BlurOp(GrSurfaceProxyView proxyView,const SkBlurArg & blurArg)23 BlurOp::BlurOp(GrSurfaceProxyView proxyView, const SkBlurArg& blurArg)
24     : GrOp(ClassID()),
25       fProxyView(proxyView),
26       skBlurArg(blurArg){
27     this->setBounds(skBlurArg.srcRect, HasAABloat::kNo, IsHairline::kNo);
28 }
29 
onCombineIfPossible(GrOp * t,SkArenaAlloc *,const GrCaps & caps)30 GrOp::CombineResult BlurOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) {
31     return CombineResult::kCannotCombine;
32 }
33 
onExecute(GrOpFlushState * state,const SkRect & chainBounds)34 void BlurOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
35     SkASSERT(state->opsRenderPass());
36     state->opsRenderPass()->drawBlurImage(fProxyView.proxy(), skBlurArg);
37 }
38 
39 } // namespace skgpu::v1
40