summaryrefslogtreecommitdiffstats
path: root/libs/hwui/SkiaShader.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2015-07-13 13:34:07 -0700
committerChris Craik <ccraik@google.com>2015-07-13 13:34:07 -0700
commite310f83d591dc3fb7bd5c684239481a586f00662 (patch)
tree01ab6dae5ea6d1a2f407f291980f931741a58126 /libs/hwui/SkiaShader.cpp
parent208934ff010cc2aff7d8fee9237d6cee0e5bb563 (diff)
downloadframeworks_base-e310f83d591dc3fb7bd5c684239481a586f00662.zip
frameworks_base-e310f83d591dc3fb7bd5c684239481a586f00662.tar.gz
frameworks_base-e310f83d591dc3fb7bd5c684239481a586f00662.tar.bz2
Fix unsafety in SkiaShader storage, and texture unit accounting
bug:22390304 Fixes two issues: 1) The max texture unit wasn't large enough to handle the most complex ComposeShader case (1 for draw primitive, 2 for gradient shader, 1 for bitmap shader). 2) If a shader isn't supported by SkiaShader::store, the shader data needs to be explicitly disabled, so we won't read uninitilized data from it when trying to read shader information out. Change-Id: I29ee7b7c1e07f67db88c1707bdc857daa305e713
Diffstat (limited to 'libs/hwui/SkiaShader.cpp')
-rw-r--r--libs/hwui/SkiaShader.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index 2cfb9e1..a2aa2d1 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -370,7 +370,11 @@ void SkiaShader::store(Caches& caches, const SkShader& shader, const Matrix4& mo
if (tryStoreLayer(caches, shader, modelViewMatrix,
textureUnit, description, &outData->layerData)) {
outData->skiaShaderType = kLayer_SkiaShaderType;
+ return;
}
+
+ // Unknown/unsupported type, so explicitly ignore shader
+ outData->skiaShaderType = kNone_SkiaShaderType;
}
void SkiaShader::apply(Caches& caches, const SkiaShaderData& data) {