blob: 5699d87c2b81a5fa453ede13903f0772bc4cb914 [file] [log] [blame]
Leon Scroggins III9febd0b2018-05-30 14:41:11 -04001/*
Leon Scroggins III22f673d2018-05-30 15:33:46 -04002 * Copyright 2009 The Android Open Source Project
Leon Scroggins III9febd0b2018-05-30 14:41:11 -04003 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Leon Scroggins III22f673d2018-05-30 15:33:46 -04008#include "SkColorTable.h"
9#include "../private/SkMalloc.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}