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

Unified Diff: bench/subset/SubsetTranslateBench.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 | « bench/subset/SubsetSingleBench.cpp ('k') | bench/subset/SubsetZoomBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/subset/SubsetTranslateBench.cpp
diff --git a/bench/subset/SubsetTranslateBench.cpp b/bench/subset/SubsetTranslateBench.cpp
index 620b6f4903b8da291ee0c8eb34809385825fb188..182969d9a2d07700f409e40a75e135f0099abb90 100644
--- a/bench/subset/SubsetTranslateBench.cpp
+++ b/bench/subset/SubsetTranslateBench.cpp
@@ -55,7 +55,7 @@ bool SubsetTranslateBench::isSuitableFor(Backend backend) {
void SubsetTranslateBench::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;
scroggo 2015/06/30 16:40:19 This got left out of patch set 2, but according to
msarett 2015/06/30 18:40:27 I switched away from this approach because I thoug
SkPMColor colors[256];
if (fUseCodec) {
for (int count = 0; count < n; count++) {
@@ -68,7 +68,8 @@ void SubsetTranslateBench::onDraw(const int n, SkCanvas* canvas) {
SkBitmap bitmap;
// Note that we use the same bitmap for all of the subsets.
// It might be larger than necessary for the end subsets.
- bitmap.allocPixels(info.makeWH(fSubsetWidth, fSubsetHeight));
+ bitmap.allocPixels(info.makeWH(fSubsetWidth, fSubsetHeight), NULL,
+ SkNEW_ARGS(SkColorTable, (colors, colorCount)));
for (int x = 0; x < info.width(); x += fSubsetWidth) {
for (int y = 0; y < info.height(); y += fSubsetHeight) {
« no previous file with comments | « bench/subset/SubsetSingleBench.cpp ('k') | bench/subset/SubsetZoomBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698