diff options
Diffstat (limited to 'src/codec/SkColorTable.cpp')
-rw-r--r-- | src/codec/SkColorTable.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/codec/SkColorTable.cpp b/src/codec/SkColorTable.cpp index ae6716b3f6..5699d87c2b 100644 --- a/src/codec/SkColorTable.cpp +++ b/src/codec/SkColorTable.cpp @@ -1,8 +1,23 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2009 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -// Dummy file to assist in landing https://skia-review.googlesource.com/c/skia/+/130845 +#include "SkColorTable.h" +#include "../private/SkMalloc.h" + +SkColorTable::SkColorTable(const SkPMColor colors[], int count) { + SkASSERT(0 == count || colors); + SkASSERT(count >= 0 && count <= 256); + + fCount = count; + fColors = reinterpret_cast<SkPMColor*>(sk_malloc_throw(count * sizeof(SkPMColor))); + + memcpy(fColors, colors, count * sizeof(SkPMColor)); +} + +SkColorTable::~SkColorTable() { + sk_free(fColors); +} |