aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-16 14:31:26 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-16 14:31:26 +0000
commitf6eac8af585e44d56e6b18d269e6c34f9917ea88 (patch)
tree46332930405593186d0956fb29f093cd0afff80f /include
parentb022177777c3602c47bb71c07920e63a261c5038 (diff)
Revert r5962 because of failures.
git-svn-id: http://skia.googlecode.com/svn/trunk@5963 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkShader.h13
-rw-r--r--include/gpu/GrSamplerState.h29
2 files changed, 24 insertions, 18 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index a0a1b056d4..8eb695cd14 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -306,13 +306,14 @@ public:
virtual GradientType asAGradient(GradientInfo* info) const;
/**
- * If the shader subclass has a GrCustomStage implementation, this installs
- * a custom stage on the sampler. A GrContext pointer is required since custom
- * stages may need to create textures. The sampler parameter is necessary to set a
- * texture matrix. It will eventually be removed and this function will operate as a
- * GrCustomStage factory.
+ * If the shader subclass has a GrCustomStage implementation, this returns
+ * a new custom stage (the caller assumes ownership, and will need to
+ * unref it). A GrContext pointer is required since custom stages may
+ * need to create textures. The sampler parameter is necessary to set
+ * up matrix/tile modes/etc, and will eventually be removed.
*/
- virtual bool asNewCustomStage(GrContext* context, GrSamplerState* sampler) const;
+ virtual GrCustomStage* asNewCustomStage(GrContext* context,
+ GrSamplerState* sampler) const;
//////////////////////////////////////////////////////////////////////////
// Factory methods for stock shaders
diff --git a/include/gpu/GrSamplerState.h b/include/gpu/GrSamplerState.h
index da52e95277..385dba7bdd 100644
--- a/include/gpu/GrSamplerState.h
+++ b/include/gpu/GrSamplerState.h
@@ -19,7 +19,14 @@
class GrSamplerState {
public:
+ static const bool kBilerpDefault = false;
+ static const SkShader::TileMode kTileModeDefault = SkShader::kClamp_TileMode;
+
+ /**
+ * Default sampler state is set to clamp, use normal sampling mode, be
+ * unfiltered, and use identity matrix.
+ */
GrSamplerState()
: fCustomStage (NULL) {
memset(this, 0, sizeof(GrSamplerState));
@@ -56,6 +63,12 @@ public:
const GrMatrix& getMatrix() const { return fMatrix; }
/**
+ * Access the sampler's matrix. See SampleMode for explanation of
+ * relationship between the matrix and sample mode.
+ */
+ GrMatrix* matrix() { return &fMatrix; }
+
+ /**
* Multiplies the current sampler matrix a matrix
*
* After this call M' = M*m where M is the old matrix, m is the parameter
@@ -67,10 +80,10 @@ public:
*/
void preConcatMatrix(const GrMatrix& matrix) { fMatrix.preConcat(matrix); }
- /**
- * Do not call this function. It will be removed soon.
- */
- void setMatrixDeprecated(const GrMatrix& matrix) { fMatrix = matrix; }
+ void reset(const GrMatrix& matrix) {
+ fMatrix = matrix;
+ GrSafeSetNull(fCustomStage);
+ }
void reset() {
fMatrix.reset();
@@ -79,16 +92,8 @@ public:
GrCustomStage* setCustomStage(GrCustomStage* stage) {
GrSafeAssign(fCustomStage, stage);
- fMatrix.reset();
return stage;
}
-
- GrCustomStage* setCustomStage(GrCustomStage* stage, const GrMatrix& matrix) {
- GrSafeAssign(fCustomStage, stage);
- fMatrix = matrix;
- return stage;
- }
-
const GrCustomStage* getCustomStage() const { return fCustomStage; }
private: