13e50e99fe7e6d5dbc3f3f834c8c312474d3ad057skia.committer@gmail.com 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/* 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2011 Google Inc. 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 7dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com */ 8dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com 9dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com#ifndef GrPathRenderer_DEFINED 10dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com#define GrPathRenderer_DEFINED 11dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com 12dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com#include "GrDrawTarget.h" 133008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com#include "GrPathRendererChain.h" 1445a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com#include "GrStencil.h" 15dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com 16e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org#include "SkDrawProcs.h" 175f74cf8c49701f514b69dc6f1a8b5c0ffd78af0asugoi@google.com#include "SkStrokeRec.h" 1849313f6b4391d0f74ab1964c295634e8830680f6bsalomon@google.com#include "SkTArray.h" 1949313f6b4391d0f74ab1964c295634e8830680f6bsalomon@google.com 2007f3ee10d34f09342abb93d758b5e151ff78f7a5reed@google.comclass SkPath; 213008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com 22dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.comstruct GrPoint; 23dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com 24dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com/** 25dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com * Base class for drawing paths into a GrDrawTarget. 26bf5cad4e9c5808493b35cb9b0000a2d36b7f9b78robertphillips@google.com * 2745a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * Derived classes can use stages GrPaint::kTotalStages through GrDrawState::kNumStages-1. The 2845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * stages before GrPaint::kTotalStages are reserved for setting up the draw (i.e., textures and 2945a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * filter masks). 30dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com */ 31a4de8c257ea0be8ff7081f645249b6afe5c48e7ecommit-bot@chromium.orgclass SK_API GrPathRenderer : public SkRefCnt { 32dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.compublic: 33fa35e3ddcc9d130ce87c927218bdf27879c38711reed@google.com SK_DECLARE_INST_COUNT(GrPathRenderer) 343008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com 353008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com /** 3645a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * This is called to install custom path renderers in every GrContext at create time. The 3745a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * default implementation in GrCreatePathRenderer_none.cpp does not add any additional 3845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * renderers. Link against another implementation to install your own. The first added is the 3945a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * most preferred path renderer, second is second most preferred, etc. 403008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com * 413008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com * @param context the context that will use the path renderer 423008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com * @param prChain the chain to add path renderers to. 433008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com */ 4445a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com static void AddPathRenderers(GrContext* context, GrPathRendererChain* prChain); 453008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com 463008519e9f977cd60194841d558a4f45c28e9833bsalomon@google.com 47c2099d2707abcc94e139627399aed4b8894b69bbbsalomon@google.com GrPathRenderer(); 48dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com 49dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com /** 5045a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * A caller may wish to use a path renderer to draw a path into the stencil buffer. However, 5145a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * the path renderer itself may require use of the stencil buffer. Also a path renderer may 52b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt * use a GrProcessor coverage stage that sets coverage to zero to eliminate pixels that are 53b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt * covered by bounding geometry but outside the path. These exterior pixels would still be 54b0a8a377f832c59cee939ad721e1f87d378b7142joshualitt * rendered into the stencil. 5545a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * 5645a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * A GrPathRenderer can provide three levels of support for stenciling paths: 5745a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * 1) kNoRestriction: This is the most general. The caller sets up the GrDrawState on the target 5845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * and calls drawPath(). The path is rendered exactly as the draw state 5945a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * indicates including support for simultaneous color and stenciling with 6045a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * arbitrary stenciling rules. Pixels partially covered by AA paths are 6145a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * affected by the stencil settings. 6245a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * 2) kStencilOnly: The path renderer cannot apply arbitrary stencil rules nor shade and stencil 6345a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * simultaneously. The path renderer does support the stencilPath() function 6445a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * which performs no color writes and writes a non-zero stencil value to pixels 6545a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * covered by the path. 6645a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * 3) kNoSupport: This path renderer cannot be used to stencil the path. 6745a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com */ 6845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com typedef GrPathRendererChain::StencilSupport StencilSupport; 6945a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com static const StencilSupport kNoSupport_StencilSupport = 7045a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com GrPathRendererChain::kNoSupport_StencilSupport; 7145a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com static const StencilSupport kStencilOnly_StencilSupport = 7245a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com GrPathRendererChain::kStencilOnly_StencilSupport; 7345a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com static const StencilSupport kNoRestriction_StencilSupport = 7445a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com GrPathRendererChain::kNoRestriction_StencilSupport; 7545a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com 7645a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com /** 77e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * This function is to get the stencil support for a particular path. The path's fill must 7845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * not be an inverse type. 79dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com * 803e0c64ad1e5e12aca2907a1384ee7dc3d39d5148robertphillips@google.com * @param target target that the path will be rendered to 81e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * @param path the path that will be drawn 82e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * @param stroke the stroke information (width, join, cap). 83dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com */ 84e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com StencilSupport getStencilSupport(const SkPath& path, 85e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com const SkStrokeRec& stroke, 86c2099d2707abcc94e139627399aed4b8894b69bbbsalomon@google.com const GrDrawTarget* target) const { 87e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com SkASSERT(!path.isInverseFillType()); 88e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com return this->onGetStencilSupport(path, stroke, target); 89c2099d2707abcc94e139627399aed4b8894b69bbbsalomon@google.com } 90ee435122d7dcb9cd4be4524004b0de282c42848bbsalomon@google.com 91208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com /** 92e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * Returns true if this path renderer is able to render the path. Returning false allows the 93e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * caller to fallback to another path renderer This function is called when searching for a path 94e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * renderer capable of rendering a path. 95208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com * 96e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * @param path The path to draw 9712b4e27ae1a29460e91a59f38122483e1faec697sugoi@google.com * @param stroke The stroke information (width, join, cap) 98208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com * @param target The target that the path will be rendered to 99208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com * @param antiAlias True if anti-aliasing is required. 100208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com * 101208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com * @return true if the path can be drawn by this object, false otherwise. 102208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com */ 103e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com virtual bool canDrawPath(const SkPath& path, 104e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com const SkStrokeRec& rec, 105c2099d2707abcc94e139627399aed4b8894b69bbbsalomon@google.com const GrDrawTarget* target, 106c2099d2707abcc94e139627399aed4b8894b69bbbsalomon@google.com bool antiAlias) const = 0; 107ee435122d7dcb9cd4be4524004b0de282c42848bbsalomon@google.com /** 108e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * Draws the path into the draw target. If getStencilSupport() would return kNoRestriction then 109e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * the subclass must respect the stencil settings of the target's draw state. 110ee435122d7dcb9cd4be4524004b0de282c42848bbsalomon@google.com * 111e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * @param path the path to draw. 11212b4e27ae1a29460e91a59f38122483e1faec697sugoi@google.com * @param stroke the stroke information (width, join, cap) 113208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com * @param target target that the path will be rendered to 114208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com * @param antiAlias true if anti-aliasing is required. 115ee435122d7dcb9cd4be4524004b0de282c42848bbsalomon@google.com */ 116e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com bool drawPath(const SkPath& path, 117e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com const SkStrokeRec& stroke, 11845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com GrDrawTarget* target, 11945a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com bool antiAlias) { 120e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com SkASSERT(!path.isEmpty()); 121e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com SkASSERT(this->canDrawPath(path, stroke, target, antiAlias)); 122f6de475e5cbd143f348ff7738919e397b7fe7f57tfarina@chromium.org SkASSERT(target->drawState()->getStencil().isDisabled() || 123e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com kNoRestriction_StencilSupport == this->getStencilSupport(path, stroke, target)); 124e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com return this->onDrawPath(path, stroke, target, antiAlias); 125c2099d2707abcc94e139627399aed4b8894b69bbbsalomon@google.com } 126ee435122d7dcb9cd4be4524004b0de282c42848bbsalomon@google.com 127ee435122d7dcb9cd4be4524004b0de282c42848bbsalomon@google.com /** 128e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * Draws the path to the stencil buffer. Assume the writable stencil bits are already 129e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * initialized to zero. The pixels inside the path will have non-zero stencil values afterwards. 130dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com * 131e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com * @param path the path to draw. 13245a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * @param stroke the stroke information (width, join, cap) 13345a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * @param target target that the path will be rendered to 134dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com */ 135e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com void stencilPath(const SkPath& path, const SkStrokeRec& stroke, GrDrawTarget* target) { 136e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com SkASSERT(!path.isEmpty()); 137e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(path, stroke, target)); 138e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com this->onStencilPath(path, stroke, target); 139dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com } 14006afe7b5a1ef03bfc6494c51ab2a1f7a386de5c2bsalomon@google.com 141e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org // Helper for determining if we can treat a thin stroke as a hairline w/ coverage. 142e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org // If we can, we draw lots faster (raster device does this same test). 143e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org static bool IsStrokeHairlineOrEquivalent(const SkStrokeRec& stroke, const SkMatrix& matrix, 144e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org SkScalar* outCoverage) { 145e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org if (stroke.isHairlineStyle()) { 14649f085dddff10473b6ebf832a974288300224e60bsalomon if (outCoverage) { 147e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org *outCoverage = SK_Scalar1; 148e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org } 149e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org return true; 150e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org } 151e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org return stroke.getStyle() == SkStrokeRec::kStroke_Style && 152e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org SkDrawTreatAAStrokeAsHairline(stroke.getWidth(), matrix, outCoverage); 153e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org } 154e0a868c84ebc34c5a16b5faa1546016abb9ca0accommit-bot@chromium.org 155d22b6e4351e552a8379d7781096d9e79feeae263tomhudson@google.comprotected: 156208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com /** 15745a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * Subclass overrides if it has any limitations of stenciling support. 15845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com */ 159e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com virtual StencilSupport onGetStencilSupport(const SkPath&, 160e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com const SkStrokeRec&, 16145a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com const GrDrawTarget*) const { 16245a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com return kNoRestriction_StencilSupport; 16345a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com } 16445a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com 16545a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com /** 16645a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * Subclass implementation of drawPath() 167208236d2b6163b977cc9bc299f8df60158ba8226bsalomon@google.com */ 168e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com virtual bool onDrawPath(const SkPath& path, 169e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com const SkStrokeRec& stroke, 170c2099d2707abcc94e139627399aed4b8894b69bbbsalomon@google.com GrDrawTarget* target, 171c2099d2707abcc94e139627399aed4b8894b69bbbsalomon@google.com bool antiAlias) = 0; 172d22b6e4351e552a8379d7781096d9e79feeae263tomhudson@google.com 17345a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com /** 17445a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * Subclass implementation of stencilPath(). Subclass must override iff it ever returns 17545a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com * kStencilOnly in onGetStencilSupport(). 17645a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com */ 177e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com virtual void onStencilPath(const SkPath& path, const SkStrokeRec& stroke, GrDrawTarget* target) { 17845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit); 17945a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com GrDrawState* drawState = target->drawState(); 18045a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com GR_STATIC_CONST_SAME_STENCIL(kIncrementStencil, 18145a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com kReplace_StencilOp, 18245a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com kReplace_StencilOp, 18345a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com kAlways_StencilFunc, 18445a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com 0xffff, 18545a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com 0xffff, 18645a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com 0xffff); 18745a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com drawState->setStencil(kIncrementStencil); 18845a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com drawState->enableState(GrDrawState::kNoColorWrites_StateBit); 189e79f320ed6c5ec9f6164ba84be1ff586532e6517robertphillips@google.com this->drawPath(path, stroke, target, false); 19045a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com } 19145a15f551b5b3c6c747d8eaf6466b7d3b76a8faebsalomon@google.com 1921dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com // Helper for getting the device bounds of a path. Inverse filled paths will have bounds set 1931dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com // by devSize. Non-inverse path bounds will not necessarily be clipped to devSize. 1941dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com static void GetPathDevBounds(const SkPath& path, 1951dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com int devW, 1961dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com int devH, 1971dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com const SkMatrix& matrix, 1981dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com SkRect* bounds); 1991dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com 2001dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com // Helper version that gets the dev width and height from a GrSurface. 2011dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com static void GetPathDevBounds(const SkPath& path, 2021dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com const GrSurface* device, 2031dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com const SkMatrix& matrix, 2041dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com SkRect* bounds) { 2051dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com GetPathDevBounds(path, device->width(), device->height(), matrix, bounds); 2061dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com } 2071dd9baa6c8faeb4ce837c39d179ce9c9a09719efbsalomon@google.com 208dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.comprivate: 209dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com 210a4de8c257ea0be8ff7081f645249b6afe5c48e7ecommit-bot@chromium.org typedef SkRefCnt INHERITED; 211dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com}; 212dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com 213dfe75bcf98b0c04535efbf7fe36492a7fb53c90dbsalomon@google.com#endif 214