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 "GrOp.h" 12 #include "GrRenderTargetProxy.h" 13 14 class GrOpFlushState; 15 16 class GrDebugMarkerOp final : public GrOp { 17 public: 18 DEFINE_OP_CLASS_ID 19 20 static std::unique_ptr<GrOp> Make(GrContext*, 21 GrRenderTargetProxy*, 22 const SkString&); 23 name()24 const char* name() const override { return "DebugMarker"; } 25 26 #ifdef SK_DEBUG dumpInfo()27 SkString dumpInfo() const override { 28 SkString string; 29 string.append(INHERITED::dumpInfo()); 30 return string; 31 } 32 #endif 33 34 private: 35 friend class GrOpMemoryPool; // for ctor 36 GrDebugMarkerOp(GrRenderTargetProxy * proxy,const SkString & str)37 GrDebugMarkerOp(GrRenderTargetProxy* proxy, const SkString& str) 38 : INHERITED(ClassID()) 39 , fStr(str) { 40 // Make this cover the whole screen so it can't be reordered around 41 this->makeFullScreen(proxy); 42 } 43 onPrepare(GrOpFlushState *)44 void onPrepare(GrOpFlushState*) override {} 45 46 void onExecute(GrOpFlushState*, const SkRect& chainBounds) override; 47 48 SkString fStr; 49 50 typedef GrOp INHERITED; 51 }; 52 53 #endif 54