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

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
Index: bench/subset/SubsetTranslateBench.cpp
diff --git a/bench/subset/SubsetTranslateBench.cpp b/bench/subset/SubsetTranslateBench.cpp
index 620b6f4903b8da291ee0c8eb34809385825fb188..70c4458e4fd83a1e8e696ade097689e287daf171 100644
--- a/bench/subset/SubsetTranslateBench.cpp
+++ b/bench/subset/SubsetTranslateBench.cpp
@@ -68,7 +68,12 @@ 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));
+ if (kIndex_8_SkColorType == fColorType) {
scroggo 2015/06/30 16:40:19 This code is almost exactly the same. Can we write
msarett 2015/06/30 18:40:28 Yes there is, good idea.
+ bitmap.allocPixels(info.makeWH(fSubsetWidth, fSubsetHeight), NULL,
+ SkNEW_ARGS(SkColorTable, (colors, colorCount)));
+ } else {
+ bitmap.allocPixels(info.makeWH(fSubsetWidth, fSubsetHeight));
+ }
for (int x = 0; x < info.width(); x += fSubsetWidth) {
for (int y = 0; y < info.height(); y += fSubsetHeight) {

Powered by Google App Engine
This is Rietveld 408576698