Revert "Revert "fix ubsan warning""

This reverts commit b03d69f070.

Reason for revert: This is the good CL I meant to re-land.

Original change's description:
> Revert "fix ubsan warning"
> 
> This reverts commit 4d1c5d676e.
> 
> Reason for revert: Valgrind requires reverting ancestor commit.
> 
> Original change's description:
> > fix ubsan warning
> > 
> > CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN
> > 
> > Change-Id: Ic8c5d95fdb899cb5293b2bc456f61b1637ec3aed
> > Reviewed-on: https://skia-review.googlesource.com/17489
> > Reviewed-by: Mike Klein <mtklein@chromium.org>
> > Commit-Queue: Mike Klein <mtklein@chromium.org>
> > 
> 
> TBR=mtklein@chromium.org,herb@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN
> 
> Change-Id: Idbfdc4773756aa475829c1421d10d6f341081d7b
> Reviewed-on: https://skia-review.googlesource.com/17521
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> 

TBR=mtklein@chromium.org,herb@google.com,reviews@skia.org,brianosman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN

Change-Id: I4cf347bc578450c0cb3c91e55fdfdbe6af6fdb13
Reviewed-on: https://skia-review.googlesource.com/17526
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2017-05-22 19:45:09 +00:00 committed by Skia Commit-Bot
parent 86ee8c40ee
commit bcd8637772

View File

@ -188,6 +188,9 @@ static void build_pipeline(const SkRasterPipeline::Stage* stages, int nstages,
}
void SkRasterPipeline::run(size_t x, size_t n) const {
if (fStages.empty()) {
return;
}
gChooseEngineOnce([]{ gPlatform = choose_engine(); });
SkAutoSTMalloc<64, void*> program(2*fStages.size() + 1);
@ -204,6 +207,9 @@ void SkRasterPipeline::run(size_t x, size_t n) const {
}
std::function<void(size_t, size_t)> SkRasterPipeline::compile(SkArenaAlloc* alloc) const {
if (fStages.empty()) {
return [](size_t, size_t) {};
}
gChooseEngineOnce([]{ gPlatform = choose_engine(); });
void** platform = alloc->makeArray<void*>(2*fStages.size() + 1);