Make GrContext track the current matrix, render target, and clip directly rather than using GrDrawState.
R=robertphillips@google.com, jvanverth@google.com
Author: bsalomon@google.com
Review URL: https://chromiumcodereview.appspot.com/15821008
git-svn-id: http://skia.googlecode.com/svn/trunk@9297 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index a3850b0..2cc50f7 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -8,7 +8,7 @@
#include "GrDrawState.h"
#include "GrPaint.h"
-void GrDrawState::setFromPaint(const GrPaint& paint) {
+void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRenderTarget* rt) {
for (int i = 0; i < GrPaint::kMaxColorStages; ++i) {
int s = i + GrPaint::kFirstColorStage;
if (paint.isColorStageEnabled(i)) {
@@ -34,8 +34,18 @@
this->disableStage(s);
}
- this->setColor(paint.getColor());
+ this->setRenderTarget(rt);
+ fCommon.fViewMatrix = vm;
+
+ // These have no equivalent in GrPaint, set them to defaults
+ fCommon.fBlendConstant = 0x0;
+ fCommon.fCoverage = 0xffffffff;
+ fCommon.fDrawFace = kBoth_DrawFace;
+ fCommon.fStencilSettings.setDisabled();
+ this->resetStateFlags();
+
+ this->setColor(paint.getColor());
this->setState(GrDrawState::kDither_StateBit, paint.isDither());
this->setState(GrDrawState::kHWAntialias_StateBit, paint.isAntiAlias());