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

Unified Diff: bench/subset/SubsetZoomBench.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/SubsetZoomBench.cpp
diff --git a/bench/subset/SubsetZoomBench.cpp b/bench/subset/SubsetZoomBench.cpp
index 3ce193b6ea8da33e7083da2c1e3386ea58ac2114..b5b560aefbffc4ee1e3fc516e47b4d30644035d3 100644
--- a/bench/subset/SubsetZoomBench.cpp
+++ b/bench/subset/SubsetZoomBench.cpp
@@ -77,7 +77,12 @@ void SubsetZoomBench::onDraw(const int n, SkCanvas* canvas) {
// Note that if we subsetted and scaled in a single step, we could use the
// same bitmap - as is often done in actual use cases.
SkBitmap bitmap;
- bitmap.allocPixels(info.makeWH(subsetWidth, subsetHeight));
+ if (kIndex_8_SkColorType == fColorType) {
+ bitmap.allocPixels(info.makeWH(subsetWidth, subsetHeight), NULL,
+ SkNEW_ARGS(SkColorTable, (colors, colorCount)));
+ } else {
+ bitmap.allocPixels(info.makeWH(subsetWidth, subsetHeight));
+ }
uint32_t bpp = info.bytesPerPixel();
scanlineDecoder->skipScanlines(subsetStartY);
« bench/subset/SubsetTranslateBench.cpp ('K') | « bench/subset/SubsetTranslateBench.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698