summaryrefslogtreecommitdiffstats
path: root/libs/hwui/renderstate
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2015-03-10 16:29:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-10 16:29:14 +0000
commitedacf22ca132ac48207a68aa30998f5b43d893b8 (patch)
tree6ad32c7946baf32c293be20857265a1d63400af2 /libs/hwui/renderstate
parentddd72599bf1d528079244df63d5f4dfdf534675e (diff)
parent182952f5eeefc2a21d76d4664ada0e2d78c1105c (diff)
downloadframeworks_base-edacf22ca132ac48207a68aa30998f5b43d893b8.zip
frameworks_base-edacf22ca132ac48207a68aa30998f5b43d893b8.tar.gz
frameworks_base-edacf22ca132ac48207a68aa30998f5b43d893b8.tar.bz2
Merge "Glop based composeLayerRegion/Rect"
Diffstat (limited to 'libs/hwui/renderstate')
-rw-r--r--libs/hwui/renderstate/Blend.cpp10
-rw-r--r--libs/hwui/renderstate/Blend.h11
-rw-r--r--libs/hwui/renderstate/MeshState.cpp5
3 files changed, 16 insertions, 10 deletions
diff --git a/libs/hwui/renderstate/Blend.cpp b/libs/hwui/renderstate/Blend.cpp
index 789f6cc..29927ed 100644
--- a/libs/hwui/renderstate/Blend.cpp
+++ b/libs/hwui/renderstate/Blend.cpp
@@ -78,10 +78,10 @@ Blend::Blend()
// gl blending off by default
}
-void Blend::enable(SkXfermode::Mode mode, bool swapSrcDst) {
+void Blend::enable(SkXfermode::Mode mode, ModeOrderSwap modeUsage) {
GLenum srcMode;
GLenum dstMode;
- getFactors(mode, swapSrcDst, &srcMode, &dstMode);
+ getFactors(mode, modeUsage, &srcMode, &dstMode);
setFactors(srcMode, dstMode);
}
@@ -105,9 +105,9 @@ void Blend::syncEnabled() {
}
}
-void Blend::getFactors(SkXfermode::Mode mode, bool swapSrcDst, GLenum* outSrc, GLenum* outDst) {
- *outSrc = swapSrcDst ? kBlendsSwap[mode].src : kBlends[mode].src;
- *outDst = swapSrcDst ? kBlendsSwap[mode].dst : kBlends[mode].dst;
+void Blend::getFactors(SkXfermode::Mode mode, ModeOrderSwap modeUsage, GLenum* outSrc, GLenum* outDst) {
+ *outSrc = (modeUsage == ModeOrderSwap::Swap) ? kBlendsSwap[mode].src : kBlends[mode].src;
+ *outDst = (modeUsage == ModeOrderSwap::Swap) ? kBlendsSwap[mode].dst : kBlends[mode].dst;
}
void Blend::setFactors(GLenum srcMode, GLenum dstMode) {
diff --git a/libs/hwui/renderstate/Blend.h b/libs/hwui/renderstate/Blend.h
index 6d0c115..dcc681d 100644
--- a/libs/hwui/renderstate/Blend.h
+++ b/libs/hwui/renderstate/Blend.h
@@ -29,11 +29,18 @@ namespace uirenderer {
class Blend {
friend class RenderState;
public:
- void enable(SkXfermode::Mode mode, bool swapSrcDst);
+ // dictates whether to swap src/dst
+ enum class ModeOrderSwap {
+ NoSwap,
+ Swap,
+ };
+
+ void enable(SkXfermode::Mode mode, ModeOrderSwap modeUsage);
void disable();
void syncEnabled();
- static void getFactors(SkXfermode::Mode mode, bool swapSrcDst, GLenum* outSrc, GLenum* outDst);
+ static void getFactors(SkXfermode::Mode mode, ModeOrderSwap modeUsage,
+ GLenum* outSrc, GLenum* outDst);
void setFactors(GLenum src, GLenum dst);
void dump();
diff --git a/libs/hwui/renderstate/MeshState.cpp b/libs/hwui/renderstate/MeshState.cpp
index 6b00020..0521f65 100644
--- a/libs/hwui/renderstate/MeshState.cpp
+++ b/libs/hwui/renderstate/MeshState.cpp
@@ -37,7 +37,7 @@ MeshState::MeshState()
mCurrentBuffer = mUnitQuadBuffer;
- std::unique_ptr<uint16_t[]> regionIndices(new uint16_t[kMaxNumberOfQuads * 6]);
+ uint16_t regionIndices[kMaxNumberOfQuads * 6];
for (uint32_t i = 0; i < kMaxNumberOfQuads; i++) {
uint16_t quad = i * 4;
int index = i * 6;
@@ -50,8 +50,7 @@ MeshState::MeshState()
}
glGenBuffers(1, &mQuadListIndices);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mQuadListIndices);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, kMaxNumberOfQuads * 6 * sizeof(uint16_t),
- regionIndices.get(), GL_STATIC_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(regionIndices), regionIndices, GL_STATIC_DRAW);
mCurrentIndicesBuffer = mQuadListIndices;
// position attribute always enabled