OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrGLGpuCommandBuffer_DEFINED | 8 #ifndef GrGLGpuCommandBuffer_DEFINED |
9 #define GrGLGpuCommandBuffer_DEFINED | 9 #define GrGLGpuCommandBuffer_DEFINED |
10 | 10 |
11 #include "GrGpuCommandBuffer.h" | 11 #include "GrGpuCommandBuffer.h" |
12 | 12 |
13 #include "GrGLGpu.h" | 13 #include "GrGLGpu.h" |
14 | 14 |
15 class GrGLGpuCommandBuffer : public GrGpuCommandBuffer { | 15 class GrGLGpuCommandBuffer : public GrGpuCommandBuffer { |
16 /** | 16 /** |
17 * We do not actually buffer up draws or do any work in the this class for GL. I
nstead commands | 17 * We do not actually buffer up draws or do any work in the this class for GL. I
nstead commands |
18 * are immediately sent to the gpu to execute. Thus all the commands in this cla
ss are simply | 18 * are immediately sent to the gpu to execute. Thus all the commands in this cla
ss are simply |
19 * pass through functions to corresponding calls in the GrGLGpu class. | 19 * pass through functions to corresponding calls in the GrGLGpu class. |
20 */ | 20 */ |
21 public: | 21 public: |
22 GrGLGpuCommandBuffer(GrGLGpu* gpu) : fGpu(gpu) {} | 22 GrGLGpuCommandBuffer(GrGLGpu* gpu) : fGpu(gpu) {} |
23 | 23 |
24 virtual ~GrGLGpuCommandBuffer() {} | 24 virtual ~GrGLGpuCommandBuffer() {} |
25 | 25 |
26 void end() override {} | 26 void end() override {} |
27 | 27 |
28 void discard(GrRenderTarget* rt) override { fGpu->discard(rt); } | 28 void discard(GrRenderTarget* rt) override {} |
29 | 29 |
30 private: | 30 private: |
31 GrGpu* gpu() override { return fGpu; } | 31 GrGpu* gpu() override { return fGpu; } |
32 | 32 |
33 void onSubmit(const SkIRect& bounds) override {} | 33 void onSubmit(const SkIRect& bounds) override {} |
34 | 34 |
35 void onDraw(const GrPipeline& pipeline, | 35 void onDraw(const GrPipeline& pipeline, |
36 const GrPrimitiveProcessor& primProc, | 36 const GrPrimitiveProcessor& primProc, |
37 const GrMesh* mesh, | 37 const GrMesh* mesh, |
38 int meshCount) override { | 38 int meshCount) override { |
39 fGpu->draw(pipeline, primProc, mesh, meshCount); | 39 fGpu->draw(pipeline, primProc, mesh, meshCount); |
40 } | 40 } |
41 | 41 |
42 void onClear(GrRenderTarget* rt, const SkIRect& rect, GrColor color) overrid
e { | 42 void onClear(GrRenderTarget* rt, const SkIRect& rect, GrColor color) overrid
e { |
43 fGpu->clear(rect, color, rt); | 43 fGpu->clear(rect, color, rt); |
44 } | 44 } |
45 | 45 |
46 void onClearStencilClip(GrRenderTarget* rt, const SkIRect& rect, bool inside
Clip) override { | 46 void onClearStencilClip(GrRenderTarget* rt, const SkIRect& rect, bool inside
Clip) override { |
47 fGpu->clearStencilClip(rect, insideClip, rt); | 47 fGpu->clearStencilClip(rect, insideClip, rt); |
48 } | 48 } |
49 | 49 |
50 GrGLGpu* fGpu; | 50 GrGLGpu* fGpu; |
51 | 51 |
52 typedef GrGpuCommandBuffer INHERITED; | 52 typedef GrGpuCommandBuffer INHERITED; |
53 }; | 53 }; |
54 | 54 |
55 #endif | 55 #endif |
56 | 56 |
OLD | NEW |