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

Unified Diff: src/gpu/GrAARectRenderer.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/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAARectRenderer.cpp
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index e743ae9080acc4329eae0900818b84f7b1cd20b0..f748895ba807ac51d8ab9b67e9a36016cc1f069d 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -6,24 +6,19 @@
*/
#include "GrAARectRenderer.h"
+#include "GrDefaultGeoProcFactory.h"
+#include "GrGeometryProcessor.h"
#include "GrGpu.h"
#include "GrInvariantOutput.h"
-#include "gl/builders/GrGLProgramBuilder.h"
-#include "gl/GrGLProcessor.h"
-#include "gl/GrGLGeometryProcessor.h"
#include "GrTBackendProcessorFactory.h"
#include "SkColorPriv.h"
-#include "GrGeometryProcessor.h"
+#include "gl/GrGLProcessor.h"
+#include "gl/GrGLGeometryProcessor.h"
+#include "gl/builders/GrGLProgramBuilder.h"
///////////////////////////////////////////////////////////////////////////////
namespace {
-extern const GrVertexAttrib gAARectAttribs[] = {
- {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
- {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
- {kFloat_GrVertexAttribType, sizeof(SkPoint) + sizeof(SkColor), kCoverage_GrVertexAttribBinding},
-};
-
// Should the coverage be multiplied into the color attrib or use a separate attrib.
enum CoverageAttribType {
kUseColor_CoverageAttribType,
@@ -33,11 +28,17 @@ enum CoverageAttribType {
static CoverageAttribType set_rect_attribs(GrDrawState* drawState) {
if (drawState->canTweakAlphaForCoverage()) {
- drawState->setVertexAttribs<gAARectAttribs>(2, sizeof(SkPoint) + sizeof(SkColor));
+ drawState->setGeometryProcessor(
+ GrDefaultGeoProcFactory::CreateAndSetAttribs(
+ drawState,
+ GrDefaultGeoProcFactory::kColor_GPType))->unref();
return kUseColor_CoverageAttribType;
} else {
- drawState->setVertexAttribs<gAARectAttribs>(3, sizeof(SkPoint) + sizeof(SkColor) +
- sizeof(float));
+ drawState->setGeometryProcessor(
+ GrDefaultGeoProcFactory::CreateAndSetAttribs(
+ drawState,
+ GrDefaultGeoProcFactory::kColor_GPType |
+ GrDefaultGeoProcFactory::kCoverage_GPType))->unref();
return kUseCoverage_CoverageAttribType;
}
}
@@ -180,6 +181,7 @@ void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
const SkMatrix& combinedMatrix,
const SkRect& devRect) {
GrDrawState* drawState = target->drawState();
+ GrDrawState::AutoRestoreEffects are(drawState);
GrColor color = drawState->getColor();
@@ -377,6 +379,7 @@ void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
const SkRect& devInside,
bool miterStroke) {
GrDrawState* drawState = target->drawState();
+ GrDrawState::AutoRestoreEffects are(drawState);
CoverageAttribType covAttribType = set_rect_attribs(drawState);
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698