• 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 "src/gpu/GrGpuCommandBuffer.h"
12 #include "src/gpu/mock/GrMockGpu.h"
13 
14 class GrMockGpuTextureCommandBuffer : public GrGpuTextureCommandBuffer {
15 public:
GrMockGpuTextureCommandBuffer(GrTexture * texture,GrSurfaceOrigin origin)16     GrMockGpuTextureCommandBuffer(GrTexture* texture, GrSurfaceOrigin origin)
17         : INHERITED(texture, origin) {
18     }
19 
~GrMockGpuTextureCommandBuffer()20     ~GrMockGpuTextureCommandBuffer() override {}
21 
copy(GrSurface * src,const SkIRect & srcRect,const SkIPoint & dstPoint)22     void copy(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override {}
transferFrom(const SkIRect & srcRect,GrColorType surfaceColorType,GrColorType bufferColorType,GrGpuBuffer * transferBuffer,size_t offset)23     void transferFrom(const SkIRect& srcRect, GrColorType surfaceColorType,
24                       GrColorType bufferColorType, GrGpuBuffer* transferBuffer,
25                       size_t offset) override {}
insertEventMarker(const char *)26     void insertEventMarker(const char*) override {}
27 
28 private:
29     typedef GrGpuTextureCommandBuffer INHERITED;
30 };
31 
32 class GrMockGpuRTCommandBuffer : public GrGpuRTCommandBuffer {
33 public:
GrMockGpuRTCommandBuffer(GrMockGpu * gpu,GrRenderTarget * rt,GrSurfaceOrigin origin)34     GrMockGpuRTCommandBuffer(GrMockGpu* gpu, GrRenderTarget* rt, GrSurfaceOrigin origin)
35             : INHERITED(rt, origin)
36             , fGpu(gpu) {
37     }
38 
gpu()39     GrGpu* gpu() override { return fGpu; }
inlineUpload(GrOpFlushState *,GrDeferredTextureUploadFn &)40     void inlineUpload(GrOpFlushState*, GrDeferredTextureUploadFn&) override {}
insertEventMarker(const char *)41     void insertEventMarker(const char*) override {}
begin()42     void begin() override {}
end()43     void end() override {}
copy(GrSurface * src,const SkIRect & srcRect,const SkIPoint & dstPoint)44     void copy(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override {}
transferFrom(const SkIRect & srcRect,GrColorType surfaceColorType,GrColorType bufferColorType,GrGpuBuffer * transferBuffer,size_t offset)45     void transferFrom(const SkIRect& srcRect, GrColorType surfaceColorType,
46                       GrColorType bufferColorType, GrGpuBuffer* transferBuffer,
47                       size_t offset) override {}
48 
numDraws()49     int numDraws() const { return fNumDraws; }
50 
51 private:
onDraw(const GrPrimitiveProcessor &,const GrPipeline &,const GrPipeline::FixedDynamicState *,const GrPipeline::DynamicStateArrays *,const GrMesh[],int meshCount,const SkRect & bounds)52     void onDraw(const GrPrimitiveProcessor&, const GrPipeline&,
53                 const GrPipeline::FixedDynamicState*, const GrPipeline::DynamicStateArrays*,
54                 const GrMesh[], int meshCount, const SkRect& bounds) override {
55         ++fNumDraws;
56     }
onClear(const GrFixedClip &,const SkPMColor4f &)57     void onClear(const GrFixedClip&, const SkPMColor4f&) override {}
onClearStencilClip(const GrFixedClip &,bool insideStencilMask)58     void onClearStencilClip(const GrFixedClip&, bool insideStencilMask) override {}
59 
60     GrMockGpu* fGpu;
61     int fNumDraws = 0;
62 
63     typedef GrGpuRTCommandBuffer INHERITED;
64 };
65 
66 #endif
67