aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuCommandBuffer.cpp
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2016-06-23 08:37:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-23 08:37:06 -0700
commit9cb6340a62a5d748e4189d50e51fa527c8c80c03 (patch)
tree340b581c1463f7983d3aaccea22c2dbf73e49db0 /src/gpu/GrGpuCommandBuffer.cpp
parentde8ae904789ed2fb617134564630d0a97edc69d1 (diff)
Start using GrGpuCommandBuffer in GrDrawTarget.
Diffstat (limited to 'src/gpu/GrGpuCommandBuffer.cpp')
-rw-r--r--src/gpu/GrGpuCommandBuffer.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gpu/GrGpuCommandBuffer.cpp b/src/gpu/GrGpuCommandBuffer.cpp
new file mode 100644
index 0000000000..f79cb0f1e6
--- /dev/null
+++ b/src/gpu/GrGpuCommandBuffer.cpp
@@ -0,0 +1,45 @@
+/*
+* Copyright 2016 Google Inc.
+*
+* Use of this source code is governed by a BSD-style license that can be
+* found in the LICENSE file.
+*/
+
+#include "GrGpuCommandBuffer.h"
+
+#include "GrGpu.h"
+#include "GrPrimitiveProcessor.h"
+#include "GrRenderTarget.h"
+#include "SkRect.h"
+
+void GrGpuCommandBuffer::submit(const SkIRect& bounds) {
+ this->gpu()->handleDirtyContext();
+ this->onSubmit(bounds);
+}
+
+void GrGpuCommandBuffer::clear(const SkIRect& rect, GrColor color, GrRenderTarget* renderTarget) {
+ SkASSERT(renderTarget);
+ SkASSERT(SkIRect::MakeWH(renderTarget->width(), renderTarget->height()).contains(rect));
+ this->onClear(renderTarget, rect, color);
+}
+
+void GrGpuCommandBuffer::clearStencilClip(const SkIRect& rect,
+ bool insideClip,
+ GrRenderTarget* renderTarget) {
+ SkASSERT(renderTarget);
+ this->onClearStencilClip(renderTarget, rect, insideClip);
+}
+
+
+bool GrGpuCommandBuffer::draw(const GrPipeline& pipeline,
+ const GrPrimitiveProcessor& primProc,
+ const GrMesh* mesh,
+ int meshCount) {
+ if (primProc.numAttribs() > this->gpu()->caps()->maxVertexAttributes()) {
+ this->gpu()->stats()->incNumFailedDraws();
+ return false;
+ }
+ this->onDraw(pipeline, primProc, mesh, meshCount);
+ return true;
+}
+