1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrDebugMarkerOp_DEFINED 9 #define GrDebugMarkerOp_DEFINED 10 11 #include "src/gpu/GrRenderTargetProxy.h" 12 #include "src/gpu/ops/GrOp.h" 13 14 class GrOpFlushState; 15 class GrRecordingContext; 16 17 class GrDebugMarkerOp final : public GrOp { 18 public: 19 DEFINE_OP_CLASS_ID 20 21 static std::unique_ptr<GrOp> Make(GrRecordingContext*, 22 GrRenderTargetProxy*, 23 const SkString&); 24 name()25 const char* name() const override { return "DebugMarker"; } 26 27 #ifdef SK_DEBUG dumpInfo()28 SkString dumpInfo() const override { 29 SkString string; 30 string.append(INHERITED::dumpInfo()); 31 return string; 32 } 33 #endif 34 35 private: 36 friend class GrOpMemoryPool; // for ctor 37 GrDebugMarkerOp(GrRenderTargetProxy * proxy,const SkString & str)38 GrDebugMarkerOp(GrRenderTargetProxy* proxy, const SkString& str) 39 : INHERITED(ClassID()) 40 , fStr(str) { 41 // Make this cover the whole screen so it can't be reordered around 42 this->makeFullScreen(proxy); 43 } 44 onPrepare(GrOpFlushState *)45 void onPrepare(GrOpFlushState*) override {} 46 47 void onExecute(GrOpFlushState*, const SkRect& chainBounds) override; 48 49 SkString fStr; 50 51 typedef GrOp INHERITED; 52 }; 53 54 #endif 55