• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
SkColorTable(const SkPMColor colors[],int count)11 SkColorTable::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 
~SkColorTable()21 SkColorTable::~SkColorTable() {
22     sk_free(fColors);
23 }
24