Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1159)

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 715903002: Push creation of default GP to the caller (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: added comment Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 38994f1d35eec84b4a784227fba6614c56cda2af..c180cc67d2974d587963388c5c5020793acd4b5d 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -8,6 +8,7 @@
#include "GrInOrderDrawBuffer.h"
#include "GrBufferAllocPool.h"
+#include "GrDefaultGeoProcFactory.h"
#include "GrDrawTargetCaps.h"
#include "GrGpu.h"
#include "GrOptDrawState.h"
@@ -74,16 +75,6 @@ void get_vertex_bounds(const void* vertices,
}
}
-
-namespace {
-
-extern const GrVertexAttrib kRectAttribs[] = {
- {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
- {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
- {kVec2f_GrVertexAttribType, sizeof(SkPoint)+sizeof(GrColor), kLocalCoord_GrVertexAttribBinding},
-};
-}
-
/** We always use per-vertex colors so that rects can be batched across color changes. Sometimes we
have explicit local coords and sometimes not. We *could* always provide explicit local coords
and just duplicate the positions when the caller hasn't provided a local coord rect, but we
@@ -95,11 +86,11 @@ extern const GrVertexAttrib kRectAttribs[] = {
The vertex attrib order is always pos, color, [local coords].
*/
static void set_vertex_attributes(GrDrawState* drawState, bool hasLocalCoords, GrColor color) {
- if (hasLocalCoords) {
- drawState->setVertexAttribs<kRectAttribs>(3, 2 * sizeof(SkPoint) + sizeof(SkColor));
- } else {
- drawState->setVertexAttribs<kRectAttribs>(2, sizeof(SkPoint) + sizeof(SkColor));
- }
+ uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
+ GrDefaultGeoProcFactory::kColor_GPType;
+ flags |= hasLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
+ drawState->setGeometryProcessor(GrDefaultGeoProcFactory::CreateAndSetAttribs(drawState,
+ flags))->unref();
if (0xFF == GrColorUnpackA(color)) {
drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
}
@@ -146,6 +137,7 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
GrDrawState* drawState = this->drawState();
+ GrDrawState::AutoRestoreEffects are(drawState);
GrColor color = drawState->getColor();
@@ -272,7 +264,6 @@ int GrInOrderDrawBuffer::concatInstancedDraw(const DrawInfo& info,
void GrInOrderDrawBuffer::onDraw(const DrawInfo& info,
const GrClipMaskManager::ScissorState& scissorState) {
-
GeometryPoolState& poolState = fGeoPoolStateStack.back();
const GrDrawState& drawState = this->getDrawState();
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698