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 #ifndef BLUROP_DEFINED 17 #define BLUROP_DEFINED 18 19 #include "include/core/SkBlurTypes.h" 20 #include "include/gpu/GrBackendSurface.h" 21 #include "include/gpu/GrTypes.h" 22 #include "src/gpu/ops/GrOp.h" 23 24 class GrOpFlushState; 25 class GrRecordingContext; 26 27 namespace skgpu::v1 { 28 29 class BlurOp final : public GrOp { 30 public: 31 DEFINE_OP_CLASS_ID 32 33 const char* name() const override { return "Blur"; } 34 35 void visitProxies(const GrVisitProxyFunc& func) const override 36 { 37 func(fProxyView.proxy(), GrMipmapped(false)); 38 } 39 private: 40 friend class GrOp; // for ctors 41 42 BlurOp(GrSurfaceProxyView proxyView, const SkBlurArg& blurArg); 43 44 CombineResult onCombineIfPossible(GrOp* t, SkArenaAlloc*, const GrCaps& caps) override; 45 46 void onPrePrepare(GrRecordingContext*, const GrSurfaceProxyView& writeView, GrAppliedClip*, 47 const GrDstProxyView&, GrXferBarrierFlags renderPassXferBarriers, 48 GrLoadOp colorLoadOp) override {} 49 50 void onPrepare(GrOpFlushState*) override {} 51 52 void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override; 53 54 GrSurfaceProxyView fProxyView; 55 SkBlurArg skBlurArg; 56 }; 57 58 } // namespace skgpu::v1 59 60 #endif // BLUROP_DEFINED 61