aboutsummaryrefslogtreecommitdiffhomepage
path: root/gpu/include
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/include')
-rw-r--r--gpu/include/GrDrawTarget.h19
-rw-r--r--gpu/include/GrGLInterface.h2
-rw-r--r--gpu/include/GrGLPlatformIncludes.h4
-rw-r--r--gpu/include/GrTexture.h1
-rw-r--r--gpu/include/GrTypes.h6
5 files changed, 32 insertions, 0 deletions
diff --git a/gpu/include/GrDrawTarget.h b/gpu/include/GrDrawTarget.h
index aef5937ea7..35f912b7c4 100644
--- a/gpu/include/GrDrawTarget.h
+++ b/gpu/include/GrDrawTarget.h
@@ -136,6 +136,7 @@ protected:
uint32_t fFlagBits;
GrBlendCoeff fSrcBlend;
GrBlendCoeff fDstBlend;
+ GrColor fBlendConstant;
GrTexture* fTextures[kNumStages];
GrSamplerState fSamplerStates[kNumStages];
GrRenderTarget* fRenderTarget;
@@ -359,6 +360,24 @@ public:
void setBlendFunc(GrBlendCoeff srcCoef, GrBlendCoeff dstCoef);
/**
+ * Sets the blending function constant referenced by the following blending
+ * coeffecients:
+ * kConstC_BlendCoeff
+ * kIConstC_BlendCoeff
+ * kConstA_BlendCoeff
+ * kIConstA_BlendCoeff
+ *
+ * @param constant the constant to set
+ */
+ void setBlendConstant(GrColor constant) { fCurrDrawState.fBlendConstant = constant; }
+
+ /**
+ * Retrieves the last value set by setBlendConstant()
+ * @return the blending constant value
+ */
+ GrColor getBlendConstant() const { return fCurrDrawState.fBlendConstant; }
+
+ /**
* Used to save and restore the GrGpu's drawing state
*/
struct SavedDrawState {
diff --git a/gpu/include/GrGLInterface.h b/gpu/include/GrGLInterface.h
index 0c2a2d9bad..0a41905361 100644
--- a/gpu/include/GrGLInterface.h
+++ b/gpu/include/GrGLInterface.h
@@ -63,6 +63,7 @@ struct GrGLInterface {
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBindAttribLocationProc)(GLuint program, GLuint index, const char* name);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBindBufferProc)(GLenum target, GLuint buffer);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBindTextureProc)(GLenum target, GLuint texture);
+ typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendColorProc)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBlendFuncProc)(GLenum sfactor, GLenum dfactor);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferDataProc)(GLenum target, GLsizei size, const void* data, GLenum usage);
typedef GLvoid (GR_GL_FUNCTION_TYPE *GrGLBufferSubDataProc)(GLenum target, GLint offset, GLsizei size, const void* data);
@@ -167,6 +168,7 @@ struct GrGLInterface {
GrGLBindBufferProc fBindBuffer;
GrGLBindTextureProc fBindTexture;
GrGLBlendFuncProc fBlendFunc;
+ GrGLBlendColorProc fBlendColor;
GrGLBufferDataProc fBufferData;
GrGLBufferSubDataProc fBufferSubData;
GrGLClearProc fClear;
diff --git a/gpu/include/GrGLPlatformIncludes.h b/gpu/include/GrGLPlatformIncludes.h
index 1a4fa40003..978a9926b5 100644
--- a/gpu/include/GrGLPlatformIncludes.h
+++ b/gpu/include/GrGLPlatformIncludes.h
@@ -335,6 +335,10 @@
#define GL_MULTISAMPLE_BIT 0x20000000
// OpenGL 1.4 Defines
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
#define GL_BLEND_DST_RGB 0x80C8
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
diff --git a/gpu/include/GrTexture.h b/gpu/include/GrTexture.h
index 666aa570f8..0a65ff75ce 100644
--- a/gpu/include/GrTexture.h
+++ b/gpu/include/GrTexture.h
@@ -89,6 +89,7 @@ public:
};
static size_t BytesPerPixel(PixelConfig);
static bool PixelConfigIsOpaque(PixelConfig);
+ static bool PixelConfigIsAlphaOnly(PixelConfig);
protected:
GrTexture(int width,
diff --git a/gpu/include/GrTypes.h b/gpu/include/GrTypes.h
index 3c137f8891..8e219f7c08 100644
--- a/gpu/include/GrTypes.h
+++ b/gpu/include/GrTypes.h
@@ -186,6 +186,12 @@ enum GrBlendCoeff {
kISA_BlendCoeff, //<! one minus src alpha
kDA_BlendCoeff, //<! dst alpha
kIDA_BlendCoeff, //<! one minus dst alpha
+ kConstC_BlendCoeff, //<! constant color
+ kIConstC_BlendCoeff, //<! one minus constant color
+ kConstA_BlendCoeff, //<! constant color alpha
+ kIConstA_BlendCoeff, //<! one minus constant color alpha
+
+ kBlendCoeffCount
};
/**