Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4051)

Unified Diff: bench/subset/SubsetSingleBench.cpp

Issue 1213983003: Fix CodecSubset benches seg faults for kIndex8 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bench/subset/SubsetTranslateBench.cpp » ('j') | bench/subset/SubsetTranslateBench.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/subset/SubsetSingleBench.cpp
diff --git a/bench/subset/SubsetSingleBench.cpp b/bench/subset/SubsetSingleBench.cpp
index 68c94cd246b125a27ba26e6bec7a2f6409006bb4..2bddbdcc23aa85027f1c67459b3b5c2f7f6271b5 100644
--- a/bench/subset/SubsetSingleBench.cpp
+++ b/bench/subset/SubsetSingleBench.cpp
@@ -59,7 +59,7 @@ bool SubsetSingleBench::isSuitableFor(Backend backend) {
void SubsetSingleBench::onDraw(const int n, SkCanvas* canvas) {
// When the color type is kIndex8, we will need to store the color table. If it is
// used, it will be initialized by the codec.
- int colorCount;
+ int colorCount = 0;
SkPMColor colors[256];
if (fUseCodec) {
for (int count = 0; count < n; count++) {
@@ -70,7 +70,8 @@ void SubsetSingleBench::onDraw(const int n, SkCanvas* canvas) {
info, NULL, colors, &colorCount);
SkBitmap bitmap;
- bitmap.allocPixels(info.makeWH(fSubsetWidth, fSubsetHeight));
+ bitmap.allocPixels(info.makeWH(fSubsetWidth, fSubsetHeight), NULL,
+ SkNEW_ARGS(SkColorTable, (colors, colorCount)));
scanlineDecoder->skipScanlines(fOffsetTop);
uint32_t bpp = info.bytesPerPixel();
« no previous file with comments | « no previous file | bench/subset/SubsetTranslateBench.cpp » ('j') | bench/subset/SubsetTranslateBench.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698