aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-11-06 10:18:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-06 15:44:37 +0000
commitf98b730af08df5b7e6989d2fc1099fbbb07f26d9 (patch)
tree9ffb66c84364ad8cf9207f9fae2125be36fc4c00
parent9c46b68d5340efc91368cef1cc5775f13c97cab8 (diff)
Call ~SkRasterPipelineBlitter() on early out.
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN-Trybot BUG=skia:5937 TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4446 Change-Id: Id74b80901e86fc1318d80e4c76cc6076cae9caa8 Reviewed-on: https://skia-review.googlesource.com/4446 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r--src/core/SkRasterPipelineBlitter.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 8f9922d47e..6aff8dd72f 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -98,6 +98,12 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
auto blitter = alloc->createT<SkRasterPipelineBlitter>(dst,
paint.getBlendMode(),
paint_color(dst, paint));
+ auto earlyOut = [&] {
+ blitter->~SkRasterPipelineBlitter();
+ alloc->freeLast();
+ return nullptr;
+ };
+
SkBlendMode* blend = &blitter->fBlend;
SkPM4f* paintColor = &blitter->fPaintColor;
SkRasterPipeline* pipeline = &blitter->fShader;
@@ -107,8 +113,7 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
// TODO: all temporary
if (!supported(dst.info()) || shader || !SkBlendMode_AppendStages(*blend)) {
- alloc->freeLast();
- return nullptr;
+ return earlyOut();
}
bool is_opaque, is_constant;
@@ -124,8 +129,7 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
if (colorFilter) {
if (!colorFilter->appendStages(pipeline, is_opaque)) {
- alloc->freeLast();
- return nullptr;
+ return earlyOut();
}
is_opaque = is_opaque && (colorFilter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag);
}