aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-07-19 15:45:45 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-19 22:20:57 +0000
commitb7648a27583a2ef775384751fee25ac9cf3db5d5 (patch)
tree60b385f2059f2c02312b6f4e4a4ceb33df3a4484 /include/core
parent1635146864586cb7caaccdbfeb8ba4906bf80c67 (diff)
removed dead colortable code
Bug: skia:6828 Change-Id: I2d3b3b7c846d3ac08bbcb9357cb644873fe5a286 Reviewed-on: https://skia-review.googlesource.com/24623 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkBitmap.h104
-rw-r--r--include/core/SkMallocPixelRef.h28
-rw-r--r--include/core/SkPixelRef.h11
-rw-r--r--include/core/SkPixmap.h14
4 files changed, 6 insertions, 151 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 6b48613db9..65b797bde8 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -9,9 +9,6 @@
#define SkBitmap_DEFINED
#include "SkColor.h"
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
-#include "SkColorTable.h"
-#endif
#include "SkImageInfo.h"
#include "SkPixmap.h"
#include "SkPoint.h"
@@ -245,8 +242,7 @@ public:
/**
* Allocate the bitmap's pixels to match the requested image info. If the Factory
- * is non-null, call it to allcoate the pixelref. If the ImageInfo requires
- * a colortable, then ColorTable must be non-null.
+ * is non-null, call it to allcoate the pixelref.
*
* On failure, the bitmap will be set to empty and return false.
*/
@@ -257,16 +253,6 @@ public:
}
}
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info, sk_sp<SkColorTable>,
- uint32_t flags = 0) {
- return this->tryAllocPixelsFlags(info, flags);
- }
- void allocPixels(const SkImageInfo& info, sk_sp<SkColorTable>, uint32_t flags = 0) {
- this->allocPixels(info, flags);
- }
-#endif
-
/**
* Allocate the bitmap's pixels to match the requested image info and
* rowBytes. If the request cannot be met (e.g. the info is invalid or
@@ -303,13 +289,6 @@ public:
this->allocPixels(info);
}
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- // TEMPORARY -- remove after updating Android BitmapTests.cpp:35
- void allocPixels(const SkImageInfo& info, std::nullptr_t, SkColorTable*) {
- this->allocPixels(info);
- }
-#endif
-
/**
* Install a pixelref that wraps the specified pixels and rowBytes, and
* optional ReleaseProc and context. When the pixels are no longer
@@ -332,17 +311,9 @@ public:
return this->installPixels(info, pixels, rowBytes, nullptr, nullptr);
}
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkColorTable*,
- void (*releaseProc)(void* addr, void* context), void* context) {
- return this->installPixels(info, pixels, rowBytes, releaseProc, context);
- }
-#endif
-
/**
- * Call installPixels with no ReleaseProc specified. This means
- * that the caller must ensure that the specified pixels and
- * colortable are valid for the lifetime of the created bitmap
+ * Call installPixels with no ReleaseProc specified. This means that the caller must ensure
+ * that the specified pixels are valid for the lifetime of the created bitmap
* (and its pixelRef).
*/
bool installPixels(const SkPixmap&);
@@ -358,11 +329,7 @@ public:
will automatically release any pixelref previously installed. Only call
this if you are handling ownership/lifetime of the pixel memory.
- If the bitmap retains a reference to the colortable (assuming it is
- not null) it will take care of incrementing the reference count.
-
@param pixels Address for the pixels, managed by the caller.
- @param ctable ColorTable (or null) that matches the specified pixels
*/
void setPixels(void* p);
@@ -371,11 +338,6 @@ public:
If this is called multiple times, a new pixelref object will be created
each time.
- If the bitmap retains a reference to the colortable (assuming it is
- not null) it will take care of incrementing the reference count.
-
- @param ctable ColorTable (or null) to use with the pixels that will
- be allocated. Only used if colortype == kIndex_8_SkColorType
@return true if the allocation succeeds. If not the pixelref field of
the bitmap will be unchanged.
*/
@@ -392,16 +354,9 @@ public:
If this is called multiple times, a new pixelref object will be created
each time.
- If the bitmap retains a reference to the colortable (assuming it is
- not null) it will take care of incrementing the reference count.
-
@param allocator The Allocator to use to create a pixelref that can
manage the pixel memory for the current ImageInfo.
If allocator is NULL, the standard HeapAllocator will be used.
- @param ctable ColorTable (or null) to use with the pixels that will
- be allocated. Only used if colortype == kIndex_8_SkColorType.
- If it is non-null and the colortype is not indexed, it will
- be ignored.
@return true if the allocation succeeds. If not the pixelref field of
the bitmap will be unchanged.
*/
@@ -413,25 +368,6 @@ public:
}
}
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- void setPixels(void* p, SkColorTable*) {
- this->setPixels(p);
- }
- bool SK_WARN_UNUSED_RESULT tryAllocPixels(SkColorTable*) {
- return this->tryAllocPixels();
- }
-
- void allocPixels(SkColorTable*) {
- this->allocPixels();
- }
- bool SK_WARN_UNUSED_RESULT tryAllocPixels(Allocator* allocator, SkColorTable*) {
- return this->tryAllocPixels(allocator);
- }
- void allocPixels(Allocator* allocator, SkColorTable*) {
- this->allocPixels(allocator);
- }
-#endif
-
/**
* Return the current pixelref object or NULL if there is none. This does
* not affect the refcount of the pixelref.
@@ -460,22 +396,12 @@ public:
void setPixelRef(sk_sp<SkPixelRef>, int dx, int dy);
/** Call this to be sure that the bitmap is valid enough to be drawn (i.e.
- it has non-null pixels, and if required by its colortype, it has a
- non-null colortable. Returns true if all of the above are met.
+ it has non-null pixels).
*/
bool readyToDraw() const {
return this->getPixels() != NULL;
}
- /** Return the bitmap's colortable, if it uses one (i.e. colorType is
- Index_8).
- Otherwise returns NULL. Does not affect the colortable's
- reference count.
- */
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- SkColorTable* getColorTable() const { return nullptr; }
-#endif
-
/** Returns a non-zero, unique value corresponding to the pixels in our
pixelref. Each time the pixels are changed (and notifyPixelsChanged
is called), a different generation ID will be returned. Finally, if
@@ -571,14 +497,6 @@ public:
*/
inline uint8_t* getAddr8(int x, int y) const;
- /** Returns the color corresponding to the pixel specified by x,y for
- * colortable based bitmaps.
- * In debug build, this asserts that the pixels are allocated,
- * that the colortype is indexed, and that the colortable is allocated,
- * however none of these checks are performed in the release build.
- */
- inline SkPMColor getIndex8Color(int x, int y) const;
-
/** Set dst to be a setset of this bitmap. If possible, it will share the
pixel memory, and just point into a subset of it. However, if the colortype
does not support this, a local copy will be made and associated with
@@ -692,15 +610,9 @@ public:
public:
/** Allocate the pixel memory for the bitmap, given its dimensions and
colortype. Return true on success, where success means either setPixels
- or setPixelRef was called. If the colortype requires a colortable,
- it also must be installed via setColorTable. If false is returned,
- the bitmap and colortable should be left unchanged.
+ or setPixelRef was called.
*/
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- virtual bool allocPixelRef(SkBitmap*, SkColorTable*) = 0;
-#else
virtual bool allocPixelRef(SkBitmap*) = 0;
-#endif
private:
typedef SkRefCnt INHERITED;
};
@@ -711,11 +623,7 @@ public:
*/
class HeapAllocator : public Allocator {
public:
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- bool allocPixelRef(SkBitmap*, SkColorTable*) override;
-#else
bool allocPixelRef(SkBitmap*) override;
-#endif
};
SK_TO_STRING_NONVIRT()
@@ -739,7 +647,7 @@ private:
uint32_t fRowBytes;
uint8_t fFlags;
- /* Unreference any pixelrefs or colortables
+ /* Unreference any pixelrefs
*/
void freePixels();
void updatePixelsFromRef();
diff --git a/include/core/SkMallocPixelRef.h b/include/core/SkMallocPixelRef.h
index 07a5483e25..dce3c0ecbb 100644
--- a/include/core/SkMallocPixelRef.h
+++ b/include/core/SkMallocPixelRef.h
@@ -9,9 +9,6 @@
#define SkMallocPixelRef_DEFINED
#include "SkPixelRef.h"
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- #include "SkData.h"
-#endif
/** We explicitly use the same allocator for our pixels that SkMask does,
so that we can freely assign memory allocated by one class to the other.
@@ -71,31 +68,6 @@ public:
*/
static sk_sp<SkPixelRef> MakeWithData(const SkImageInfo&, size_t rowBytes, sk_sp<SkData> data);
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- static sk_sp<SkPixelRef> MakeDirect(const SkImageInfo& info, void* addr,
- size_t rowBytes, sk_sp<SkColorTable>) {
- return MakeDirect(info, addr, rowBytes);
- }
- static sk_sp<SkPixelRef> MakeAllocate(const SkImageInfo& info, size_t rb, sk_sp<SkColorTable>) {
- return MakeAllocate(info, rb);
- }
- static sk_sp<SkPixelRef> MakeZeroed(const SkImageInfo& info, size_t rb, sk_sp<SkColorTable>) {
- return MakeZeroed(info, rb);
- }
- static sk_sp<SkPixelRef> MakeWithProc(const SkImageInfo& info,
- size_t rowBytes, sk_sp<SkColorTable>,
- void* addr, ReleaseProc proc,
- void* context) {
- return MakeWithProc(info, rowBytes, addr, proc, context);
- }
- static sk_sp<SkPixelRef> MakeWithData(const SkImageInfo& info,
- size_t rowBytes,
- sk_sp<SkColorTable>,
- sk_sp<SkData> data) {
- return MakeWithData(info, rowBytes, data);
- }
-#endif
-
protected:
~SkMallocPixelRef() override;
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 25a8d52540..b14cbdf20e 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -19,9 +19,6 @@
#include "SkSize.h"
#include "SkString.h"
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
-class SkColorTable;
-#endif
struct SkIRect;
class GrTexture;
@@ -102,19 +99,11 @@ public:
virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return NULL; }
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- SkPixelRef(int width, int height, void* addr, size_t rowBytes, sk_sp<SkColorTable>);
- SkColorTable* colorTable() const { return nullptr; }
-#endif
protected:
// default impl does nothing.
virtual void onNotifyPixelsChanged();
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- void android_only_reset(int width, int height, size_t rowBytes, sk_sp<SkColorTable>);
-#else
void android_only_reset(int width, int height, size_t rowBytes);
-#endif
private:
int fWidth;
diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h
index 1ea011b348..c703386d1f 100644
--- a/include/core/SkPixmap.h
+++ b/include/core/SkPixmap.h
@@ -12,9 +12,6 @@
#include "SkFilterQuality.h"
#include "SkImageInfo.h"
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
-class SkColorTable;
-#endif
class SkData;
struct SkMask;
@@ -210,17 +207,6 @@ public:
bool erase(SkColor color) const { return this->erase(color, this->bounds()); }
bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const;
-#ifdef SK_SUPPORT_LEGACY_COLORTABLE
- SkPixmap(const SkImageInfo& info, const void* addr, size_t rowBytes, SkColorTable*)
- : fPixels(addr), fRowBytes(rowBytes), fInfo(info)
- {}
- void reset(const SkImageInfo& info, const void* addr, size_t rowBytes,
- SkColorTable*) {
- this->reset(info, addr, rowBytes);
- }
- SkColorTable* ctable() const { return nullptr; }
-#endif
-
private:
const void* fPixels;
size_t fRowBytes;