| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2015 The Android Open Source Project | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SubsetBenchPriv_DEFINED | |
| 9 #define SubsetBenchPriv_DEFINED | |
| 10 | |
| 11 #include "SkCodec.h" | |
| 12 #include "SkData.h" | |
| 13 #include "SkImageGenerator.h" | |
| 14 | |
| 15 /* | |
| 16 * If we plan to decode to kIndex8, we must create a color table and pass it to
the | |
| 17 * bitmap when we allocate pixels. Otherwise, we simply allocate pixels using t
he | |
| 18 * decode info. | |
| 19 */ | |
| 20 static inline void alloc_pixels(SkBitmap* bitmap, const SkImageInfo& info, SkPMC
olor* colors, | |
| 21 int colorCount) { | |
| 22 if (kIndex_8_SkColorType == info.colorType()) { | |
| 23 SkAutoTUnref<SkColorTable> colorTable(new SkColorTable(colors, colorCoun
t)); | |
| 24 bitmap->allocPixels(info, nullptr, colorTable); | |
| 25 } else { | |
| 26 bitmap->allocPixels(info); | |
| 27 } | |
| 28 } | |
| 29 | |
| 30 #endif // SubsetBenchPriv_DEFINED | |
| OLD | NEW |