1/*
2 * Copyright 2009 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#include "include/private/SkMalloc.h"
9#include "src/codec/SkColorTable.h"
10
11SkColorTable::SkColorTable(const SkPMColor colors[], int count) {
12 SkASSERT(0 == count || colors);
13 SkASSERT(count >= 0 && count <= 256);
14
15 fCount = count;
16 fColors = reinterpret_cast<SkPMColor*>(sk_malloc_throw(count * sizeof(SkPMColor)));
17
18 memcpy(fColors, colors, count * sizeof(SkPMColor));
19}
20
21SkColorTable::~SkColorTable() {
22 sk_free(fColors);
23}
24