epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
bsalomon@google.com | 3008519 | 2011-08-19 15:42:31 +0000 | [diff] [blame^] | 8 | |
bsalomon@google.com | ffca400 | 2011-02-22 20:34:01 +0000 | [diff] [blame] | 9 | #include "GrPathRenderer.h" |
| 10 | |
tomhudson@google.com | d22b6e4 | 2011-06-24 15:53:40 +0000 | [diff] [blame] | 11 | GrPathRenderer::GrPathRenderer() |
bsalomon@google.com | ee43512 | 2011-07-01 14:57:55 +0000 | [diff] [blame] | 12 | : fCurveTolerance (GR_Scalar1) |
| 13 | , fPath(NULL) |
| 14 | , fTarget(NULL) { |
tomhudson@google.com | d22b6e4 | 2011-06-24 15:53:40 +0000 | [diff] [blame] | 15 | } |
bsalomon@google.com | ee43512 | 2011-07-01 14:57:55 +0000 | [diff] [blame] | 16 | |
bsalomon@google.com | ee43512 | 2011-07-01 14:57:55 +0000 | [diff] [blame] | 17 | void GrPathRenderer::setPath(GrDrawTarget* target, |
| 18 | const SkPath* path, |
| 19 | GrPathFill fill, |
| 20 | const GrPoint* translate) { |
| 21 | GrAssert(NULL == fPath); |
| 22 | GrAssert(NULL == fTarget); |
| 23 | GrAssert(NULL != target); |
| 24 | |
| 25 | fTarget = target; |
| 26 | fPath = path; |
| 27 | fFill = fill; |
| 28 | if (NULL != translate) { |
| 29 | fTranslate = *translate; |
| 30 | } else { |
| 31 | fTranslate.fX = fTranslate.fY = 0; |
| 32 | } |
| 33 | this->pathWasSet(); |
| 34 | } |
| 35 | |
| 36 | void GrPathRenderer::clearPath() { |
| 37 | this->pathWillClear(); |
| 38 | fTarget->resetVertexSource(); |
bsalomon@google.com | 25fd36c | 2011-07-06 17:41:08 +0000 | [diff] [blame] | 39 | fTarget->resetIndexSource(); |
bsalomon@google.com | ee43512 | 2011-07-01 14:57:55 +0000 | [diff] [blame] | 40 | fTarget = NULL; |
| 41 | fPath = NULL; |
| 42 | } |