aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2018-05-30 15:33:46 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-01 12:53:25 +0000
commit22f673d42087853a151fcd5e95c129be83065cdc (patch)
treee4e711677a1e6a02b261acd9346c587ff260d7a0
parent9ea47bedb945fe51c7805b4f2defccccb8249865 (diff)
Move SkColorTable to src/codec
It is no longer needed anywhere else, and simply happens to be an implementation detail of SkCodec (at least for now). Remove references to SkColorTable in other classes, and clean up some includes of SkConvertPixels I found along the way. Remove unused includes/methods on SkColorTable Change-Id: I46c8e46f5b77c37710b6cf595d48107d55871d52 Reviewed-on: https://skia-review.googlesource.com/130845 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
-rw-r--r--BUILD.gn1
-rw-r--r--gn/core.gni1
-rw-r--r--src/codec/SkCodecImageGenerator.h2
-rw-r--r--src/codec/SkColorTable.cpp19
-rw-r--r--src/codec/SkColorTable.h (renamed from src/core/SkColorTable.h)9
-rw-r--r--src/core/SkBitmap.cpp5
-rw-r--r--src/core/SkBitmapDevice.cpp2
-rw-r--r--src/core/SkColorTable.cpp31
-rw-r--r--src/core/SkConvertPixels.cpp7
-rw-r--r--src/core/SkConvertPixels.h2
-rw-r--r--src/core/SkPixmap.cpp2
-rw-r--r--src/gpu/GrContext.cpp1
-rw-r--r--src/gpu/SkGr.cpp1
13 files changed, 26 insertions, 57 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 42cbb293a7..5fa81c0f7e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -860,6 +860,7 @@ component("skia") {
"src/codec/SkBmpStandardCodec.cpp",
"src/codec/SkCodec.cpp",
"src/codec/SkCodecImageGenerator.cpp",
+ "src/codec/SkColorTable.cpp",
"src/codec/SkGifCodec.cpp",
"src/codec/SkMaskSwizzler.cpp",
"src/codec/SkMasks.cpp",
diff --git a/gn/core.gni b/gn/core.gni
index 56b335cf0a..abc23b93fc 100644
--- a/gn/core.gni
+++ b/gn/core.gni
@@ -86,7 +86,6 @@ skia_core_sources = [
"$_src/core/SkColorSpaceXformSteps.cpp",
"$_src/core/SkColorSpaceXformer.cpp",
"$_src/core/SkColorSpaceXformer.h",
- "$_src/core/SkColorTable.cpp",
"$_src/core/SkConvertPixels.cpp",
"$_src/core/SkConvertPixels.h",
"$_src/core/SkCoreBlitters.h",
diff --git a/src/codec/SkCodecImageGenerator.h b/src/codec/SkCodecImageGenerator.h
index 2bbf118941..b9c9d3c129 100644
--- a/src/codec/SkCodecImageGenerator.h
+++ b/src/codec/SkCodecImageGenerator.h
@@ -8,7 +8,6 @@
#define SkCodecImageGenerator_DEFINED
#include "SkCodec.h"
-#include "SkColorTable.h"
#include "SkData.h"
#include "SkImageGenerator.h"
@@ -38,7 +37,6 @@ private:
std::unique_ptr<SkCodec> fCodec;
sk_sp<SkData> fData;
- sk_sp<SkColorTable> fColorTable;
typedef SkImageGenerator INHERITED;
};
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);
+}
diff --git a/src/core/SkColorTable.h b/src/codec/SkColorTable.h
index c56e6fe917..57681a9049 100644
--- a/src/core/SkColorTable.h
+++ b/src/codec/SkColorTable.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2012 Google Inc.
*
@@ -6,14 +5,11 @@
* found in the LICENSE file.
*/
-
#ifndef SkColorTable_DEFINED
#define SkColorTable_DEFINED
-#include "../private/SkOnce.h"
#include "SkColor.h"
-#include "SkFlattenable.h"
-#include "SkImageInfo.h"
+#include "SkRefCnt.h"
/** \class SkColorTable
@@ -44,9 +40,6 @@ public:
/** Return the array of colors for reading. */
const SkPMColor* readColors() const { return fColors; }
- // may return null
- static void Skip(SkReadBuffer&);
-
private:
SkPMColor* fColors;
int fCount;
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 579573367f..1b6b6b2f5a 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -8,7 +8,6 @@
#include "SkAtomics.h"
#include "SkBitmap.h"
#include "SkColorData.h"
-#include "SkColorTable.h"
#include "SkConvertPixels.h"
#include "SkData.h"
#include "SkFilterQuality.h"
@@ -502,7 +501,7 @@ bool SkBitmap::writePixels(const SkPixmap& src, int dstX, int dstY,
void* dstPixels = this->getAddr(rec.fX, rec.fY);
const SkImageInfo dstInfo = this->info().makeWH(rec.fInfo.width(), rec.fInfo.height());
SkConvertPixels(dstInfo, dstPixels, this->rowBytes(), rec.fInfo, rec.fPixels, rec.fRowBytes,
- nullptr, behavior);
+ behavior);
this->notifyPixelsChanged();
return true;
}
@@ -522,7 +521,7 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha, int
return false;
}
SkConvertPixels(SkImageInfo::MakeA8(pmap.width(), pmap.height()), alpha, alphaRowBytes,
- pmap.info(), pmap.addr(), pmap.rowBytes(), nullptr,
+ pmap.info(), pmap.addr(), pmap.rowBytes(),
SkTransferFunctionBehavior::kRespect);
return true;
}
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 522f016a2d..71b85af268 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -187,8 +187,6 @@ public:
}
};
-class SkColorTable;
-
static bool valid_for_bitmap_device(const SkImageInfo& info,
SkAlphaType* newAlphaType) {
if (info.width() < 0 || info.height() < 0) {
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
deleted file mode 100644
index 022b9f8ae3..0000000000
--- a/src/core/SkColorTable.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-#include "SkColorTable.h"
-#include "SkReadBuffer.h"
-#include "SkWriteBuffer.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);
-}
-
-void SkColorTable::Skip(SkReadBuffer& buffer) {
- const int count = buffer.getArrayCount();
- if (buffer.validate(count >= 0 && count <= 256)) {
- buffer.skip(count * sizeof(SkPMColor));
- }
-}
diff --git a/src/core/SkConvertPixels.cpp b/src/core/SkConvertPixels.cpp
index ddc04c06b6..b0d37cd89f 100644
--- a/src/core/SkConvertPixels.cpp
+++ b/src/core/SkConvertPixels.cpp
@@ -7,7 +7,6 @@
#include "SkColorSpaceXformPriv.h"
#include "SkColorSpacePriv.h"
-#include "SkColorTable.h"
#include "SkConvertPixels.h"
#include "SkHalf.h"
#include "SkImageInfoPriv.h"
@@ -164,7 +163,7 @@ static inline bool apply_color_xform(const SkImageInfo& dstInfo, void* dstPixels
// Fast Path 4: Alpha 8 dsts.
static void convert_to_alpha8(uint8_t* dst, size_t dstRB, const SkImageInfo& srcInfo,
- const void* src, size_t srcRB, SkColorTable* ctable) {
+ const void* src, size_t srcRB) {
if (srcInfo.isOpaque()) {
for (int y = 0; y < srcInfo.height(); ++y) {
memset(dst, 0xFF, srcInfo.width());
@@ -405,7 +404,7 @@ static bool swizzle_and_multiply_color_type(SkColorType ct) {
void SkConvertPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
const SkImageInfo& srcInfo, const void* srcPixels, size_t srcRB,
- SkColorTable* ctable, SkTransferFunctionBehavior behavior) {
+ SkTransferFunctionBehavior behavior) {
SkASSERT(dstInfo.dimensions() == srcInfo.dimensions());
SkASSERT(SkImageInfoValidConversion(dstInfo, srcInfo));
@@ -434,7 +433,7 @@ void SkConvertPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
// Fast Path 4: Alpha 8 dsts.
if (kAlpha_8_SkColorType == dstInfo.colorType()) {
- convert_to_alpha8((uint8_t*) dstPixels, dstRB, srcInfo, srcPixels, srcRB, ctable);
+ convert_to_alpha8((uint8_t*) dstPixels, dstRB, srcInfo, srcPixels, srcRB);
return;
}
diff --git a/src/core/SkConvertPixels.h b/src/core/SkConvertPixels.h
index c825d84aa1..001052b7a8 100644
--- a/src/core/SkConvertPixels.h
+++ b/src/core/SkConvertPixels.h
@@ -15,7 +15,7 @@ class SkColorTable;
void SkConvertPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
const SkImageInfo& srcInfo, const void* srcPixels, size_t srcRowBytes,
- SkColorTable* srcCTable, SkTransferFunctionBehavior behavior);
+ SkTransferFunctionBehavior behavior);
static inline void SkRectMemcpy(void* dst, size_t dstRB, const void* src, size_t srcRB,
size_t bytesPerRow, int rowCount) {
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp
index 852ffb0b33..446f25b2f2 100644
--- a/src/core/SkPixmap.cpp
+++ b/src/core/SkPixmap.cpp
@@ -89,7 +89,7 @@ bool SkPixmap::readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t ds
const void* srcPixels = this->addr(rec.fX, rec.fY);
const SkImageInfo srcInfo = fInfo.makeWH(rec.fInfo.width(), rec.fInfo.height());
SkConvertPixels(rec.fInfo, rec.fPixels, rec.fRowBytes, srcInfo, srcPixels, this->rowBytes(),
- nullptr, behavior);
+ behavior);
return true;
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 3d57f9818d..c9c476fb1a 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -27,7 +27,6 @@
#include "GrTextureStripAtlas.h"
#include "GrTracing.h"
#include "SkAutoPixmapStorage.h"
-#include "SkConvertPixels.h"
#include "SkDeferredDisplayList.h"
#include "SkGr.h"
#include "SkImageInfoPriv.h"
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index a37523fc06..528d133e2d 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -21,7 +21,6 @@
#include "SkBlendModePriv.h"
#include "SkCanvas.h"
#include "SkColorFilter.h"
-#include "SkConvertPixels.h"
#include "SkData.h"
#include "SkImage_Base.h"
#include "SkImageInfoPriv.h"