Home | History | Annotate | Download | only in mock
      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:
     16     GrMockGpuCommandBuffer(GrMockGpu* gpu) : fGpu(gpu) {}
     17 
     18     GrGpu* gpu() override { return fGpu; }
     19     void inlineUpload(GrOpFlushState*, GrDrawOp::DeferredUploadFn&, GrRenderTarget*) override {}
     20     void discard(GrRenderTarget*) override {}
     21     void end() override {}
     22 
     23     int numDraws() const { return fNumDraws; }
     24 
     25 private:
     26     void onSubmit() override { fGpu->submitCommandBuffer(this); }
     27     void onDraw(const GrPipeline&, const GrPrimitiveProcessor&, const GrMesh[],
     28                 const GrPipeline::DynamicState[], int meshCount, const SkRect& bounds) override {
     29         ++fNumDraws;
     30     }
     31     void onClear(GrRenderTarget*, const GrFixedClip&, GrColor) override {}
     32     void onClearStencilClip(GrRenderTarget*, const GrFixedClip&, bool insideStencilMask) override {}
     33     GrRenderTarget* renderTarget() override { return nullptr; }
     34 
     35     GrMockGpu* fGpu;
     36     int fNumDraws = 0;
     37 
     38     typedef GrGpuCommandBuffer INHERITED;
     39 };
     40 
     41 #endif
     42