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 #include "GrGpuCommandBuffer.h" | 8 #include "GrGpuCommandBuffer.h" |
9 | 9 |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
| 11 #include "GrFixedClip.h" |
11 #include "GrGpu.h" | 12 #include "GrGpu.h" |
12 #include "GrPrimitiveProcessor.h" | 13 #include "GrPrimitiveProcessor.h" |
13 #include "GrRenderTarget.h" | 14 #include "GrRenderTarget.h" |
14 #include "SkRect.h" | 15 #include "SkRect.h" |
15 | 16 |
16 void GrGpuCommandBuffer::submit(const SkIRect& bounds) { | 17 void GrGpuCommandBuffer::submit(const SkIRect& bounds) { |
17 this->gpu()->handleDirtyContext(); | 18 this->gpu()->handleDirtyContext(); |
18 this->onSubmit(bounds); | 19 this->onSubmit(bounds); |
19 } | 20 } |
20 | 21 |
21 void GrGpuCommandBuffer::clear(const SkIRect& rect, GrColor color, GrRenderTarge
t* renderTarget) { | 22 void GrGpuCommandBuffer::clear(const GrFixedClip& clip, GrColor color, GrRenderT
arget* rt) { |
22 SkASSERT(renderTarget); | 23 SkASSERT(rt); |
23 SkASSERT(SkIRect::MakeWH(renderTarget->width(), renderTarget->height()).cont
ains(rect)); | 24 SkASSERT(!clip.scissorEnabled() || |
24 this->onClear(renderTarget, rect, color); | 25 (SkIRect::MakeWH(rt->width(), rt->height()).contains(clip.scissorRe
ct()) && |
| 26 SkIRect::MakeWH(rt->width(), rt->height()) != clip.scissorRect()))
; |
| 27 this->onClear(rt, clip, color); |
25 } | 28 } |
26 | 29 |
27 void GrGpuCommandBuffer::clearStencilClip(const SkIRect& rect, | 30 void GrGpuCommandBuffer::clearStencilClip(const GrFixedClip& clip, |
28 bool insideClip, | 31 bool insideStencilMask, |
29 GrRenderTarget* renderTarget) { | 32 GrRenderTarget* rt) { |
30 SkASSERT(renderTarget); | 33 SkASSERT(rt); |
31 this->onClearStencilClip(renderTarget, rect, insideClip); | 34 this->onClearStencilClip(rt, clip, insideStencilMask); |
32 } | 35 } |
33 | 36 |
34 | 37 |
35 bool GrGpuCommandBuffer::draw(const GrPipeline& pipeline, | 38 bool GrGpuCommandBuffer::draw(const GrPipeline& pipeline, |
36 const GrPrimitiveProcessor& primProc, | 39 const GrPrimitiveProcessor& primProc, |
37 const GrMesh* mesh, | 40 const GrMesh* mesh, |
38 int meshCount) { | 41 int meshCount) { |
39 if (primProc.numAttribs() > this->gpu()->caps()->maxVertexAttributes()) { | 42 if (primProc.numAttribs() > this->gpu()->caps()->maxVertexAttributes()) { |
40 this->gpu()->stats()->incNumFailedDraws(); | 43 this->gpu()->stats()->incNumFailedDraws(); |
41 return false; | 44 return false; |
42 } | 45 } |
43 this->onDraw(pipeline, primProc, mesh, meshCount); | 46 this->onDraw(pipeline, primProc, mesh, meshCount); |
44 return true; | 47 return true; |
45 } | 48 } |
46 | 49 |
OLD | NEW |