• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GrMockGpuCommandBuffer_DEFINED
9 #define GrMockGpuCommandBuffer_DEFINED
10 
11 #include "GrGpuCommandBuffer.h"
12 #include "GrMockGpu.h"
13 
14 class GrMockGpuCommandBuffer : public GrGpuCommandBuffer {
15 public:
GrMockGpuCommandBuffer(GrMockGpu * gpu)16     GrMockGpuCommandBuffer(GrMockGpu* gpu) : fGpu(gpu) {}
17 
gpu()18     GrGpu* gpu() override { return fGpu; }
inlineUpload(GrOpFlushState *,GrDrawOp::DeferredUploadFn &,GrRenderTarget *)19     void inlineUpload(GrOpFlushState*, GrDrawOp::DeferredUploadFn&, GrRenderTarget*) override {}
discard(GrRenderTarget *)20     void discard(GrRenderTarget*) override {}
end()21     void end() override {}
22 
numDraws()23     int numDraws() const { return fNumDraws; }
24 
25 private:
onSubmit()26     void onSubmit() override { fGpu->submitCommandBuffer(this); }
onDraw(const GrPipeline &,const GrPrimitiveProcessor &,const GrMesh[],const GrPipeline::DynamicState[],int meshCount,const SkRect & bounds)27     void onDraw(const GrPipeline&, const GrPrimitiveProcessor&, const GrMesh[],
28                 const GrPipeline::DynamicState[], int meshCount, const SkRect& bounds) override {
29         ++fNumDraws;
30     }
onClear(GrRenderTarget *,const GrFixedClip &,GrColor)31     void onClear(GrRenderTarget*, const GrFixedClip&, GrColor) override {}
onClearStencilClip(GrRenderTarget *,const GrFixedClip &,bool insideStencilMask)32     void onClearStencilClip(GrRenderTarget*, const GrFixedClip&, bool insideStencilMask) override {}
renderTarget()33     GrRenderTarget* renderTarget() override { return nullptr; }
34 
35     GrMockGpu* fGpu;
36     int fNumDraws = 0;
37 
38     typedef GrGpuCommandBuffer INHERITED;
39 };
40 
41 #endif
42