diff options
Diffstat (limited to 'gpu/include/GrContext.h')
-rw-r--r-- | gpu/include/GrContext.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gpu/include/GrContext.h b/gpu/include/GrContext.h index 3fe1a7b367..37ac1c4999 100644 --- a/gpu/include/GrContext.h +++ b/gpu/include/GrContext.h @@ -645,6 +645,7 @@ private: */ class GrAutoMatrix : GrNoncopyable { public: + GrAutoMatrix() : fContext(NULL) {} GrAutoMatrix(GrContext* ctx) : fContext(ctx) { fMatrix = ctx->getMatrix(); } @@ -652,8 +653,25 @@ public: fMatrix = ctx->getMatrix(); ctx->setMatrix(matrix); } + void set(GrContext* ctx) { + if (NULL != fContext) { + fContext->setMatrix(fMatrix); + } + fMatrix = ctx->getMatrix(); + fContext = ctx; + } + void set(GrContext* ctx, const GrMatrix& matrix) { + if (NULL != fContext) { + fContext->setMatrix(fMatrix); + } + fMatrix = ctx->getMatrix(); + ctx->setMatrix(matrix); + fContext = ctx; + } ~GrAutoMatrix() { - fContext->setMatrix(fMatrix); + if (NULL != fContext) { + fContext->setMatrix(fMatrix); + } } private: |