aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrSamplerState.h
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-08 19:20:57 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-08 19:20:57 +0000
commit0a97be216df494291fe929b79d438809af7e9c83 (patch)
tree52f2ec03220298033823783657755a023f37d221 /include/gpu/GrSamplerState.h
parent318cf92202b765e90b7b53cb92a5a3649f8536d0 (diff)
When GL_RGBA readPixels are slow do swizzle using a draw then readPixels with GL_BGRA
Review URL: http://codereview.appspot.com/5339051/ git-svn-id: http://skia.googlecode.com/svn/trunk@2631 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/gpu/GrSamplerState.h')
-rw-r--r--include/gpu/GrSamplerState.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/gpu/GrSamplerState.h b/include/gpu/GrSamplerState.h
index 324472c972..9c217dbf9c 100644
--- a/include/gpu/GrSamplerState.h
+++ b/include/gpu/GrSamplerState.h
@@ -112,6 +112,7 @@ public:
fSampleMode = kNormal_SampleMode;
fFilter = filter;
fMatrix.setIdentity();
+ fSwapRAndB = false;
fTextureDomain.setEmpty();
}
@@ -125,6 +126,7 @@ public:
fSampleMode = kNormal_SampleMode;
fFilter = filter;
fMatrix = matrix;
+ fSwapRAndB = false;
fTextureDomain.setEmpty();
}
@@ -138,6 +140,7 @@ public:
fSampleMode = sample;
fMatrix = matrix;
fFilter = filter;
+ fSwapRAndB = false;
fTextureDomain.setEmpty();
}
@@ -151,6 +154,7 @@ public:
int getKernelWidth() const { return fKernelWidth; }
const float* getKernel() const { return fKernel; }
const float* getImageIncrement() const { return fImageIncrement; }
+ bool swapsRAndB() const { return fSwapRAndB; }
bool isGradient() const {
return kRadial_SampleMode == fSampleMode ||
@@ -177,6 +181,12 @@ public:
void setTextureDomain(const GrRect& textureDomain) { fTextureDomain = textureDomain; }
/**
+ * Swaps the R and B components when reading from the texture. Has no effect
+ * if the texture is alpha only.
+ */
+ void setRAndBSwap(bool swap) { fSwapRAndB = swap; }
+
+ /**
* Multiplies the current sampler matrix a matrix
*
* After this call M' = M*m where M is the old matrix, m is the parameter
@@ -201,6 +211,7 @@ public:
fFilter = kNearest_Filter;
fMatrix.setIdentity();
fTextureDomain.setEmpty();
+ fSwapRAndB = false;
}
GrScalar getRadial2CenterX1() const { return fRadial2CenterX1; }
@@ -246,6 +257,7 @@ private:
SampleMode fSampleMode;
Filter fFilter;
GrMatrix fMatrix;
+ bool fSwapRAndB;
GrRect fTextureDomain;
// these are undefined unless fSampleMode == kRadial2_SampleMode