SkColorTable locking serves no purpose anymore.
The only thing the unlock methods were doing was assert their balance. This removes the unlock methods and renames the lock methods "read". BUG=skia: Review URL: https://codereview.chromium.org/719213008
This commit is contained in:
parent
ba1bf8af8d
commit
775b8199a2
@ -271,13 +271,13 @@ public:
|
|||||||
isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
|
isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
|
||||||
return this->tryAllocPixels(info);
|
return this->tryAllocPixels(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
SK_ALLOCPIXELS_RETURN_TYPE allocN32Pixels(int width, int height, bool isOpaque = false) {
|
SK_ALLOCPIXELS_RETURN_TYPE allocN32Pixels(int width, int height, bool isOpaque = false) {
|
||||||
SkImageInfo info = SkImageInfo::MakeN32(width, height,
|
SkImageInfo info = SkImageInfo::MakeN32(width, height,
|
||||||
isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
|
isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
|
||||||
return this->allocPixels(info);
|
return this->allocPixels(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install a pixelref that wraps the specified pixels and rowBytes, and
|
* Install a pixelref that wraps the specified pixels and rowBytes, and
|
||||||
* optional ReleaseProc and context. When the pixels are no longer
|
* optional ReleaseProc and context. When the pixels are no longer
|
||||||
@ -798,60 +798,6 @@ private:
|
|||||||
//TODO(mtklein): uncomment when 71713004 lands and Chromium's fixed.
|
//TODO(mtklein): uncomment when 71713004 lands and Chromium's fixed.
|
||||||
//#define SkAutoLockPixels(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockPixels)
|
//#define SkAutoLockPixels(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockPixels)
|
||||||
|
|
||||||
/** Helper class that performs the lock/unlockColors calls on a colortable.
|
|
||||||
The destructor will call unlockColors(false) if it has a bitmap's colortable
|
|
||||||
*/
|
|
||||||
class SkAutoLockColors : SkNoncopyable {
|
|
||||||
public:
|
|
||||||
/** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's
|
|
||||||
colortable
|
|
||||||
*/
|
|
||||||
SkAutoLockColors() : fCTable(NULL), fColors(NULL) {}
|
|
||||||
/** Initialize with bitmap, locking its colortable if present
|
|
||||||
*/
|
|
||||||
explicit SkAutoLockColors(const SkBitmap& bm) {
|
|
||||||
fCTable = bm.getColorTable();
|
|
||||||
fColors = fCTable ? fCTable->lockColors() : NULL;
|
|
||||||
}
|
|
||||||
/** Initialize with a colortable (may be null)
|
|
||||||
*/
|
|
||||||
explicit SkAutoLockColors(SkColorTable* ctable) {
|
|
||||||
fCTable = ctable;
|
|
||||||
fColors = ctable ? ctable->lockColors() : NULL;
|
|
||||||
}
|
|
||||||
~SkAutoLockColors() {
|
|
||||||
if (fCTable) {
|
|
||||||
fCTable->unlockColors();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Return the currently locked colors, or NULL if no bitmap's colortable
|
|
||||||
is currently locked.
|
|
||||||
*/
|
|
||||||
const SkPMColor* colors() const { return fColors; }
|
|
||||||
|
|
||||||
/** Locks the table and returns is colors (assuming ctable is not null) and
|
|
||||||
unlocks the previous table if one was present
|
|
||||||
*/
|
|
||||||
const SkPMColor* lockColors(SkColorTable* ctable) {
|
|
||||||
if (fCTable) {
|
|
||||||
fCTable->unlockColors();
|
|
||||||
}
|
|
||||||
fCTable = ctable;
|
|
||||||
fColors = ctable ? ctable->lockColors() : NULL;
|
|
||||||
return fColors;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SkPMColor* lockColors(const SkBitmap& bm) {
|
|
||||||
return this->lockColors(bm.getColorTable());
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
SkColorTable* fCTable;
|
|
||||||
const SkPMColor* fColors;
|
|
||||||
};
|
|
||||||
#define SkAutoLockColors(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockColors)
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
inline uint32_t* SkBitmap::getAddr32(int x, int y) const {
|
inline uint32_t* SkBitmap::getAddr32(int x, int y) const {
|
||||||
|
@ -30,43 +30,26 @@ public:
|
|||||||
virtual ~SkColorTable();
|
virtual ~SkColorTable();
|
||||||
|
|
||||||
/** Returns the number of colors in the table.
|
/** Returns the number of colors in the table.
|
||||||
*/
|
*/
|
||||||
int count() const { return fCount; }
|
int count() const { return fCount; }
|
||||||
|
|
||||||
/** Returns the specified color from the table. In the debug build, this asserts that
|
/** Returns the specified color from the table. In the debug build, this asserts that
|
||||||
the index is in range (0 <= index < count).
|
* the index is in range (0 <= index < count).
|
||||||
*/
|
*/
|
||||||
SkPMColor operator[](int index) const {
|
SkPMColor operator[](int index) const {
|
||||||
SkASSERT(fColors != NULL && (unsigned)index < (unsigned)fCount);
|
SkASSERT(fColors != NULL && (unsigned)index < (unsigned)fCount);
|
||||||
return fColors[index];
|
return fColors[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// TODO: Would making the read() methods const allow us to avoid copies?
|
||||||
* Return the array of colors for reading. This must be balanced by a call
|
|
||||||
* to unlockColors().
|
|
||||||
*/
|
|
||||||
const SkPMColor* lockColors() {
|
|
||||||
SkDEBUGCODE(sk_atomic_inc(&fColorLockCount);)
|
|
||||||
return fColors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/** Return the array of colors for reading.
|
||||||
* Balancing call to lockColors().
|
|
||||||
*/
|
*/
|
||||||
void unlockColors();
|
const SkPMColor* readColors() { return fColors; }
|
||||||
|
|
||||||
/** Similar to lockColors(), lock16BitCache() returns the array of
|
/** read16BitCache() returns the array of RGB16 colors that mirror the 32bit colors.
|
||||||
RGB16 colors that mirror the 32bit colors. However, this function
|
*/
|
||||||
will return null if kColorsAreOpaque_Flag is not set.
|
const uint16_t* read16BitCache();
|
||||||
Also, unlike lockColors(), the returned array here cannot be modified.
|
|
||||||
*/
|
|
||||||
const uint16_t* lock16BitCache();
|
|
||||||
/** Balancing call to lock16BitCache().
|
|
||||||
*/
|
|
||||||
void unlock16BitCache() {
|
|
||||||
SkASSERT(f16BitCacheLockCount > 0);
|
|
||||||
SkDEBUGCODE(sk_atomic_dec(&f16BitCacheLockCount);)
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit SkColorTable(SkReadBuffer&);
|
explicit SkColorTable(SkReadBuffer&);
|
||||||
void writeToBuffer(SkWriteBuffer&) const;
|
void writeToBuffer(SkWriteBuffer&) const;
|
||||||
@ -75,13 +58,9 @@ private:
|
|||||||
SkPMColor* fColors;
|
SkPMColor* fColors;
|
||||||
uint16_t* f16BitCache;
|
uint16_t* f16BitCache;
|
||||||
int fCount;
|
int fCount;
|
||||||
SkDEBUGCODE(int fColorLockCount;)
|
|
||||||
SkDEBUGCODE(int f16BitCacheLockCount;)
|
|
||||||
|
|
||||||
void init(const SkPMColor* colors, int count);
|
void init(const SkPMColor* colors, int count);
|
||||||
|
|
||||||
void inval16BitCache();
|
|
||||||
|
|
||||||
typedef SkRefCnt INHERITED;
|
typedef SkRefCnt INHERITED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -284,20 +284,20 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes)
|
|||||||
if (!this->setInfo(requestedInfo, rowBytes)) {
|
if (!this->setInfo(requestedInfo, rowBytes)) {
|
||||||
return reset_return_false(this);
|
return reset_return_false(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setInfo may have corrected info (e.g. 565 is always opaque).
|
// setInfo may have corrected info (e.g. 565 is always opaque).
|
||||||
const SkImageInfo& correctedInfo = this->info();
|
const SkImageInfo& correctedInfo = this->info();
|
||||||
// setInfo may have computed a valid rowbytes if 0 were passed in
|
// setInfo may have computed a valid rowbytes if 0 were passed in
|
||||||
rowBytes = this->rowBytes();
|
rowBytes = this->rowBytes();
|
||||||
|
|
||||||
SkMallocPixelRef::PRFactory defaultFactory;
|
SkMallocPixelRef::PRFactory defaultFactory;
|
||||||
|
|
||||||
SkPixelRef* pr = defaultFactory.create(correctedInfo, rowBytes, NULL);
|
SkPixelRef* pr = defaultFactory.create(correctedInfo, rowBytes, NULL);
|
||||||
if (NULL == pr) {
|
if (NULL == pr) {
|
||||||
return reset_return_false(this);
|
return reset_return_false(this);
|
||||||
}
|
}
|
||||||
this->setPixelRef(pr)->unref();
|
this->setPixelRef(pr)->unref();
|
||||||
|
|
||||||
// TODO: lockPixels could/should return bool or void*/NULL
|
// TODO: lockPixels could/should return bool or void*/NULL
|
||||||
this->lockPixels();
|
this->lockPixels();
|
||||||
if (NULL == this->getPixels()) {
|
if (NULL == this->getPixels()) {
|
||||||
@ -586,11 +586,10 @@ bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) {
|
|||||||
return true;
|
return true;
|
||||||
} break;
|
} break;
|
||||||
case kIndex_8_SkColorType: {
|
case kIndex_8_SkColorType: {
|
||||||
SkAutoLockColors alc(bm);
|
if (!bm.getColorTable()) {
|
||||||
const SkPMColor* table = alc.colors();
|
|
||||||
if (!table) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const SkPMColor* table = bm.getColorTable()->readColors();
|
||||||
SkPMColor c = (SkPMColor)~0;
|
SkPMColor c = (SkPMColor)~0;
|
||||||
for (int i = bm.getColorTable()->count() - 1; i >= 0; --i) {
|
for (int i = bm.getColorTable()->count() - 1; i >= 0; --i) {
|
||||||
c &= table[i];
|
c &= table[i];
|
||||||
@ -848,15 +847,15 @@ bool SkBitmap::readPixels(const SkImageInfo& requestedDstInfo, void* dstPixels,
|
|||||||
if (0 == requestedDstInfo.width() || 0 == requestedDstInfo.height()) {
|
if (0 == requestedDstInfo.width() || 0 == requestedDstInfo.height()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkIRect srcR = SkIRect::MakeXYWH(x, y, requestedDstInfo.width(), requestedDstInfo.height());
|
SkIRect srcR = SkIRect::MakeXYWH(x, y, requestedDstInfo.width(), requestedDstInfo.height());
|
||||||
if (!srcR.intersect(0, 0, this->width(), this->height())) {
|
if (!srcR.intersect(0, 0, this->width(), this->height())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the intersect may have shrunk info's logical size
|
// the intersect may have shrunk info's logical size
|
||||||
const SkImageInfo dstInfo = requestedDstInfo.makeWH(srcR.width(), srcR.height());
|
const SkImageInfo dstInfo = requestedDstInfo.makeWH(srcR.width(), srcR.height());
|
||||||
|
|
||||||
// if x or y are negative, then we have to adjust pixels
|
// if x or y are negative, then we have to adjust pixels
|
||||||
if (x > 0) {
|
if (x > 0) {
|
||||||
x = 0;
|
x = 0;
|
||||||
@ -868,16 +867,16 @@ bool SkBitmap::readPixels(const SkImageInfo& requestedDstInfo, void* dstPixels,
|
|||||||
dstPixels = ((char*)dstPixels - y * dstRB - x * dstInfo.bytesPerPixel());
|
dstPixels = ((char*)dstPixels - y * dstRB - x * dstInfo.bytesPerPixel());
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
SkAutoLockPixels alp(*this);
|
SkAutoLockPixels alp(*this);
|
||||||
|
|
||||||
// since we don't stop creating un-pixeled devices yet, check for no pixels here
|
// since we don't stop creating un-pixeled devices yet, check for no pixels here
|
||||||
if (NULL == this->getPixels()) {
|
if (NULL == this->getPixels()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkImageInfo srcInfo = this->info().makeWH(dstInfo.width(), dstInfo.height());
|
const SkImageInfo srcInfo = this->info().makeWH(dstInfo.width(), dstInfo.height());
|
||||||
|
|
||||||
const void* srcPixels = this->getAddr(srcR.x(), srcR.y());
|
const void* srcPixels = this->getAddr(srcR.x(), srcR.y());
|
||||||
return SkPixelInfo::CopyPixels(dstInfo, dstPixels, dstRB, srcInfo, srcPixels, this->rowBytes(),
|
return SkPixelInfo::CopyPixels(dstInfo, dstPixels, dstRB, srcInfo, srcPixels, this->rowBytes(),
|
||||||
this->getColorTable());
|
this->getColorTable());
|
||||||
@ -1067,7 +1066,7 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha,
|
|||||||
} else if (kIndex_8_SkColorType == colorType && !src.isOpaque()) {
|
} else if (kIndex_8_SkColorType == colorType && !src.isOpaque()) {
|
||||||
SkColorTable* ct = src.getColorTable();
|
SkColorTable* ct = src.getColorTable();
|
||||||
if (ct) {
|
if (ct) {
|
||||||
const SkPMColor* SK_RESTRICT table = ct->lockColors();
|
const SkPMColor* SK_RESTRICT table = ct->readColors();
|
||||||
const uint8_t* SK_RESTRICT s = src.getAddr8(0, 0);
|
const uint8_t* SK_RESTRICT s = src.getAddr8(0, 0);
|
||||||
while (--h >= 0) {
|
while (--h >= 0) {
|
||||||
for (int x = 0; x < w; x++) {
|
for (int x = 0; x < w; x++) {
|
||||||
@ -1076,7 +1075,6 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha,
|
|||||||
s += rb;
|
s += rb;
|
||||||
alpha += alphaRowBytes;
|
alpha += alphaRowBytes;
|
||||||
}
|
}
|
||||||
ct->unlockColors();
|
|
||||||
}
|
}
|
||||||
} else { // src is opaque, so just fill alpha[] with 0xFF
|
} else { // src is opaque, so just fill alpha[] with 0xFF
|
||||||
memset(alpha, 0xFF, h * alphaRowBytes);
|
memset(alpha, 0xFF, h * alphaRowBytes);
|
||||||
|
@ -154,10 +154,10 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
|
|||||||
#define SRCTYPE uint8_t
|
#define SRCTYPE uint8_t
|
||||||
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
|
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
|
||||||
SkASSERT(state.fAlphaScale == 256)
|
SkASSERT(state.fAlphaScale == 256)
|
||||||
#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
|
#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->readColors()
|
||||||
#define RETURNDST(src) table[src]
|
#define RETURNDST(src) table[src]
|
||||||
#define SRC_TO_FILTER(src) table[src]
|
#define SRC_TO_FILTER(src) table[src]
|
||||||
#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
|
#define POSTAMBLE(state)
|
||||||
#include "SkBitmapProcState_sample.h"
|
#include "SkBitmapProcState_sample.h"
|
||||||
|
|
||||||
#undef FILTER_PROC
|
#undef FILTER_PROC
|
||||||
@ -169,10 +169,10 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
|
|||||||
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
|
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
|
||||||
SkASSERT(state.fAlphaScale < 256)
|
SkASSERT(state.fAlphaScale < 256)
|
||||||
#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale; \
|
#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale; \
|
||||||
const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
|
const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->readColors()
|
||||||
#define RETURNDST(src) SkAlphaMulQ(table[src], alphaScale)
|
#define RETURNDST(src) SkAlphaMulQ(table[src], alphaScale)
|
||||||
#define SRC_TO_FILTER(src) table[src]
|
#define SRC_TO_FILTER(src) table[src]
|
||||||
#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
|
#define POSTAMBLE(state)
|
||||||
#include "SkBitmapProcState_sample.h"
|
#include "SkBitmapProcState_sample.h"
|
||||||
|
|
||||||
// SRC == 4444
|
// SRC == 4444
|
||||||
@ -280,10 +280,10 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
|
|||||||
#define SRCTYPE uint8_t
|
#define SRCTYPE uint8_t
|
||||||
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
|
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType()); \
|
||||||
SkASSERT(state.fBitmap->isOpaque())
|
SkASSERT(state.fBitmap->isOpaque())
|
||||||
#define PREAMBLE(state) const uint16_t* SK_RESTRICT table = state.fBitmap->getColorTable()->lock16BitCache()
|
#define PREAMBLE(state) const uint16_t* SK_RESTRICT table = state.fBitmap->getColorTable()->read16BitCache()
|
||||||
#define RETURNDST(src) table[src]
|
#define RETURNDST(src) table[src]
|
||||||
#define SRC_TO_FILTER(src) table[src]
|
#define SRC_TO_FILTER(src) table[src]
|
||||||
#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlock16BitCache()
|
#define POSTAMBLE(state)
|
||||||
#include "SkBitmapProcState_sample.h"
|
#include "SkBitmapProcState_sample.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -335,9 +335,9 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
|
|||||||
#define SRCTYPE uint8_t
|
#define SRCTYPE uint8_t
|
||||||
#define DSTTYPE uint32_t
|
#define DSTTYPE uint32_t
|
||||||
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType())
|
#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fBitmap->colorType())
|
||||||
#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->lockColors()
|
#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fBitmap->getColorTable()->readColors()
|
||||||
#define SRC_TO_FILTER(src) table[src]
|
#define SRC_TO_FILTER(src) table[src]
|
||||||
#define POSTAMBLE(state) state.fBitmap->getColorTable()->unlockColors()
|
#define POSTAMBLE(state)
|
||||||
#include "SkBitmapProcState_shaderproc.h"
|
#include "SkBitmapProcState_shaderproc.h"
|
||||||
|
|
||||||
#undef NAME_WRAP
|
#undef NAME_WRAP
|
||||||
|
@ -19,11 +19,8 @@ void SkColorTable::init(const SkPMColor colors[], int count) {
|
|||||||
f16BitCache = NULL;
|
f16BitCache = NULL;
|
||||||
fCount = count;
|
fCount = count;
|
||||||
fColors = reinterpret_cast<SkPMColor*>(sk_malloc_throw(count * sizeof(SkPMColor)));
|
fColors = reinterpret_cast<SkPMColor*>(sk_malloc_throw(count * sizeof(SkPMColor)));
|
||||||
|
|
||||||
memcpy(fColors, colors, count * sizeof(SkPMColor));
|
memcpy(fColors, colors, count * sizeof(SkPMColor));
|
||||||
|
|
||||||
SkDEBUGCODE(fColorLockCount = 0;)
|
|
||||||
SkDEBUGCODE(f16BitCacheLockCount = 0;)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// As copy constructor is hidden in the class hierarchy, we need to call
|
// As copy constructor is hidden in the class hierarchy, we need to call
|
||||||
@ -43,18 +40,10 @@ SkColorTable::SkColorTable(const SkPMColor colors[], int count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkColorTable::~SkColorTable() {
|
SkColorTable::~SkColorTable() {
|
||||||
SkASSERT(fColorLockCount == 0);
|
|
||||||
SkASSERT(f16BitCacheLockCount == 0);
|
|
||||||
|
|
||||||
sk_free(fColors);
|
sk_free(fColors);
|
||||||
sk_free(f16BitCache);
|
sk_free(f16BitCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkColorTable::unlockColors() {
|
|
||||||
SkASSERT(fColorLockCount != 0);
|
|
||||||
SkDEBUGCODE(sk_atomic_dec(&fColorLockCount);)
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "SkColorPriv.h"
|
#include "SkColorPriv.h"
|
||||||
|
|
||||||
static inline void build_16bitcache(uint16_t dst[], const SkPMColor src[],
|
static inline void build_16bitcache(uint16_t dst[], const SkPMColor src[],
|
||||||
@ -64,13 +53,11 @@ static inline void build_16bitcache(uint16_t dst[], const SkPMColor src[],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint16_t* SkColorTable::lock16BitCache() {
|
const uint16_t* SkColorTable::read16BitCache() {
|
||||||
if (NULL == f16BitCache) {
|
if (NULL == f16BitCache) {
|
||||||
f16BitCache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t));
|
f16BitCache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t));
|
||||||
build_16bitcache(f16BitCache, fColors, fCount);
|
build_16bitcache(f16BitCache, fColors, fCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkDEBUGCODE(sk_atomic_inc(&f16BitCacheLockCount));
|
|
||||||
return f16BitCache;
|
return f16BitCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,9 +65,6 @@ const uint16_t* SkColorTable::lock16BitCache() {
|
|||||||
|
|
||||||
SkColorTable::SkColorTable(SkReadBuffer& buffer) {
|
SkColorTable::SkColorTable(SkReadBuffer& buffer) {
|
||||||
f16BitCache = NULL;
|
f16BitCache = NULL;
|
||||||
SkDEBUGCODE(fColorLockCount = 0;)
|
|
||||||
SkDEBUGCODE(f16BitCacheLockCount = 0;)
|
|
||||||
|
|
||||||
if (buffer.isVersionLT(SkReadBuffer::kRemoveColorTableAlpha_Version)) {
|
if (buffer.isVersionLT(SkReadBuffer::kRemoveColorTableAlpha_Version)) {
|
||||||
/*fAlphaType = */buffer.readUInt();
|
/*fAlphaType = */buffer.readUInt();
|
||||||
}
|
}
|
||||||
|
@ -154,13 +154,13 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t
|
|||||||
dstPI.fAlphaType = dstInfo.alphaType();
|
dstPI.fAlphaType = dstInfo.alphaType();
|
||||||
dstPI.fPixels = dstPixels;
|
dstPI.fPixels = dstPixels;
|
||||||
dstPI.fRowBytes = dstRB;
|
dstPI.fRowBytes = dstRB;
|
||||||
|
|
||||||
SkSrcPixelInfo srcPI;
|
SkSrcPixelInfo srcPI;
|
||||||
srcPI.fColorType = srcInfo.colorType();
|
srcPI.fColorType = srcInfo.colorType();
|
||||||
srcPI.fAlphaType = srcInfo.alphaType();
|
srcPI.fAlphaType = srcInfo.alphaType();
|
||||||
srcPI.fPixels = srcPixels;
|
srcPI.fPixels = srcPixels;
|
||||||
srcPI.fRowBytes = srcRB;
|
srcPI.fRowBytes = srcRB;
|
||||||
|
|
||||||
return srcPI.convertPixelsTo(&dstPI, width, height);
|
return srcPI.convertPixelsTo(&dstPI, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,13 +196,13 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t
|
|||||||
// Our method for converting to 4444 assumes premultiplied.
|
// Our method for converting to 4444 assumes premultiplied.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkPMColor* table = NULL;
|
const SkPMColor* table = NULL;
|
||||||
if (kIndex_8_SkColorType == srcInfo.colorType()) {
|
if (kIndex_8_SkColorType == srcInfo.colorType()) {
|
||||||
if (NULL == ctable) {
|
if (NULL == ctable) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
table = ctable->lockColors();
|
table = ctable->readColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
@ -222,10 +222,6 @@ bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t
|
|||||||
dstPixels = (char*)dstPixels + dstRB;
|
dstPixels = (char*)dstPixels + dstRB;
|
||||||
srcPixels = (const char*)srcPixels + srcRB;
|
srcPixels = (const char*)srcPixels + srcRB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (table) {
|
|
||||||
ctable->unlockColors();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
const SkPMColor* ctable = NULL;
|
const SkPMColor* ctable = NULL;
|
||||||
|
|
||||||
if fSource.getColorTable())
|
if fSource.getColorTable())
|
||||||
ctable = fSource.getColorTable()->lockColors();
|
ctable = fSource.getColorTable()->readColors();
|
||||||
|
|
||||||
while (--height >= 0)
|
while (--height >= 0)
|
||||||
{
|
{
|
||||||
@ -34,9 +34,6 @@ public:
|
|||||||
dst += dstRB;
|
dst += dstRB;
|
||||||
src += srcRB;
|
src += srcRB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if fSource.getColorTable())
|
|
||||||
fSource.getColorTable()->unlockColors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -142,10 +142,10 @@ public:
|
|||||||
#define SkSPRITE_SRC_TYPE uint8_t
|
#define SkSPRITE_SRC_TYPE uint8_t
|
||||||
#define SkSPRITE_DST_GETADDR getAddr16
|
#define SkSPRITE_DST_GETADDR getAddr16
|
||||||
#define SkSPRITE_SRC_GETADDR getAddr8
|
#define SkSPRITE_SRC_GETADDR getAddr8
|
||||||
#define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getColorTable()->lockColors()
|
#define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getColorTable()->readColors()
|
||||||
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Opaque_Pixel(dst, ctable[src])
|
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Opaque_Pixel(dst, ctable[src])
|
||||||
#define SkSPRITE_NEXT_ROW
|
#define SkSPRITE_NEXT_ROW
|
||||||
#define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlockColors()
|
#define SkSPRITE_POSTAMBLE(srcBM)
|
||||||
#include "SkSpriteBlitterTemplate.h"
|
#include "SkSpriteBlitterTemplate.h"
|
||||||
|
|
||||||
#define SkSPRITE_CLASSNAME Sprite_D16_SIndex8A_Blend
|
#define SkSPRITE_CLASSNAME Sprite_D16_SIndex8A_Blend
|
||||||
@ -156,10 +156,10 @@ public:
|
|||||||
#define SkSPRITE_SRC_TYPE uint8_t
|
#define SkSPRITE_SRC_TYPE uint8_t
|
||||||
#define SkSPRITE_DST_GETADDR getAddr16
|
#define SkSPRITE_DST_GETADDR getAddr16
|
||||||
#define SkSPRITE_SRC_GETADDR getAddr8
|
#define SkSPRITE_SRC_GETADDR getAddr8
|
||||||
#define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getColorTable()->lockColors(); unsigned src_scale = SkAlpha255To256(fSrcAlpha);
|
#define SkSPRITE_PREAMBLE(srcBM, x, y) const SkPMColor* ctable = srcBM.getColorTable()->readColors(); unsigned src_scale = SkAlpha255To256(fSrcAlpha);
|
||||||
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Blend_Pixel(dst, ctable[src], src_scale)
|
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S32A_Blend_Pixel(dst, ctable[src], src_scale)
|
||||||
#define SkSPRITE_NEXT_ROW
|
#define SkSPRITE_NEXT_ROW
|
||||||
#define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlockColors();
|
#define SkSPRITE_POSTAMBLE(srcBM)
|
||||||
#include "SkSpriteBlitterTemplate.h"
|
#include "SkSpriteBlitterTemplate.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -234,10 +234,10 @@ static void blitrow_d16_si8(uint16_t* SK_RESTRICT dst,
|
|||||||
#define SkSPRITE_SRC_TYPE uint8_t
|
#define SkSPRITE_SRC_TYPE uint8_t
|
||||||
#define SkSPRITE_DST_GETADDR getAddr16
|
#define SkSPRITE_DST_GETADDR getAddr16
|
||||||
#define SkSPRITE_SRC_GETADDR getAddr8
|
#define SkSPRITE_SRC_GETADDR getAddr8
|
||||||
#define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getColorTable()->lock16BitCache()
|
#define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getColorTable()->read16BitCache()
|
||||||
#define SkSPRITE_BLIT_PIXEL(dst, src) *dst = ctable[src]
|
#define SkSPRITE_BLIT_PIXEL(dst, src) *dst = ctable[src]
|
||||||
#define SkSPRITE_NEXT_ROW
|
#define SkSPRITE_NEXT_ROW
|
||||||
#define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlock16BitCache()
|
#define SkSPRITE_POSTAMBLE(srcBM)
|
||||||
#include "SkSpriteBlitterTemplate.h"
|
#include "SkSpriteBlitterTemplate.h"
|
||||||
|
|
||||||
#define SkSPRITE_CLASSNAME Sprite_D16_SIndex8_Blend
|
#define SkSPRITE_CLASSNAME Sprite_D16_SIndex8_Blend
|
||||||
@ -248,10 +248,10 @@ static void blitrow_d16_si8(uint16_t* SK_RESTRICT dst,
|
|||||||
#define SkSPRITE_SRC_TYPE uint8_t
|
#define SkSPRITE_SRC_TYPE uint8_t
|
||||||
#define SkSPRITE_DST_GETADDR getAddr16
|
#define SkSPRITE_DST_GETADDR getAddr16
|
||||||
#define SkSPRITE_SRC_GETADDR getAddr8
|
#define SkSPRITE_SRC_GETADDR getAddr8
|
||||||
#define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getColorTable()->lock16BitCache(); unsigned src_scale = SkAlpha255To256(fSrcAlpha);
|
#define SkSPRITE_PREAMBLE(srcBM, x, y) const uint16_t* ctable = srcBM.getColorTable()->read16BitCache(); unsigned src_scale = SkAlpha255To256(fSrcAlpha);
|
||||||
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S16_Blend_Pixel(dst, ctable[src], src_scale)
|
#define SkSPRITE_BLIT_PIXEL(dst, src) D16_S16_Blend_Pixel(dst, ctable[src], src_scale)
|
||||||
#define SkSPRITE_NEXT_ROW
|
#define SkSPRITE_NEXT_ROW
|
||||||
#define SkSPRITE_POSTAMBLE(srcBM) srcBM.getColorTable()->unlock16BitCache();
|
#define SkSPRITE_POSTAMBLE(srcBM)
|
||||||
#include "SkSpriteBlitterTemplate.h"
|
#include "SkSpriteBlitterTemplate.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -56,13 +56,11 @@ static void build_index8_data(void* buffer, const SkBitmap& bitmap) {
|
|||||||
SkSrcPixelInfo srcPI;
|
SkSrcPixelInfo srcPI;
|
||||||
srcPI.fColorType = kN32_SkColorType;
|
srcPI.fColorType = kN32_SkColorType;
|
||||||
srcPI.fAlphaType = kPremul_SkAlphaType;
|
srcPI.fAlphaType = kPremul_SkAlphaType;
|
||||||
srcPI.fPixels = ctable->lockColors();
|
srcPI.fPixels = ctable->readColors();
|
||||||
srcPI.fRowBytes = count * sizeof(SkPMColor);
|
srcPI.fRowBytes = count * sizeof(SkPMColor);
|
||||||
|
|
||||||
srcPI.convertPixelsTo(&dstPI, count, 1);
|
srcPI.convertPixelsTo(&dstPI, count, 1);
|
||||||
|
|
||||||
ctable->unlockColors();
|
|
||||||
|
|
||||||
// always skip a full 256 number of entries, even if we memcpy'd fewer
|
// always skip a full 256 number of entries, even if we memcpy'd fewer
|
||||||
dst += 256 * sizeof(GrColor);
|
dst += 256 * sizeof(GrColor);
|
||||||
|
|
||||||
@ -205,7 +203,7 @@ static GrTexture *load_etc1_texture(GrContext* ctx, bool cache,
|
|||||||
// then we don't know how to scale the image to match it...
|
// then we don't know how to scale the image to match it...
|
||||||
if (ktx.width() != bm.width() || ktx.height() != bm.height()) {
|
if (ktx.width() != bm.width() || ktx.height() != bm.height()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = ktx.pixelData();
|
bytes = ktx.pixelData();
|
||||||
desc.fConfig = kETC1_GrPixelConfig;
|
desc.fConfig = kETC1_GrPixelConfig;
|
||||||
@ -481,7 +479,7 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor
|
|||||||
dm = SkXfermode::kISA_Coeff;
|
dm = SkXfermode::kISA_Coeff;
|
||||||
}
|
}
|
||||||
grPaint->setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm));
|
grPaint->setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm));
|
||||||
|
|
||||||
//set the color of the paint to the one of the parameter
|
//set the color of the paint to the one of the parameter
|
||||||
grPaint->setColor(paintColor);
|
grPaint->setColor(paintColor);
|
||||||
|
|
||||||
|
@ -199,8 +199,7 @@ bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const int count = ctable->count();
|
const int count = ctable->count();
|
||||||
memcpy(ctableEntries, ctable->lockColors(), count * sizeof(SkPMColor));
|
memcpy(ctableEntries, ctable->readColors(), count * sizeof(SkPMColor));
|
||||||
ctable->unlockColors();
|
|
||||||
*ctableCount = count;
|
*ctableCount = count;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1355,7 +1355,6 @@ protected:
|
|||||||
|
|
||||||
// allocate these before set call setjmp
|
// allocate these before set call setjmp
|
||||||
SkAutoMalloc oneRow;
|
SkAutoMalloc oneRow;
|
||||||
SkAutoLockColors ctLocker;
|
|
||||||
|
|
||||||
cinfo.err = jpeg_std_error(&sk_err);
|
cinfo.err = jpeg_std_error(&sk_err);
|
||||||
sk_err.error_exit = skjpeg_error_exit;
|
sk_err.error_exit = skjpeg_error_exit;
|
||||||
@ -1392,7 +1391,7 @@ protected:
|
|||||||
const int width = bm.width();
|
const int width = bm.width();
|
||||||
uint8_t* oneRowP = (uint8_t*)oneRow.reset(width * 3);
|
uint8_t* oneRowP = (uint8_t*)oneRow.reset(width * 3);
|
||||||
|
|
||||||
const SkPMColor* colors = ctLocker.lockColors(bm);
|
const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : NULL;
|
||||||
const void* srcRow = bm.getPixels();
|
const void* srcRow = bm.getPixels();
|
||||||
|
|
||||||
while (cinfo.next_scanline < cinfo.image_height) {
|
while (cinfo.next_scanline < cinfo.image_height) {
|
||||||
|
@ -413,8 +413,8 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
|
|||||||
even if our decodedBitmap doesn't, due to the request that we
|
even if our decodedBitmap doesn't, due to the request that we
|
||||||
upscale png's palette to a direct model
|
upscale png's palette to a direct model
|
||||||
*/
|
*/
|
||||||
SkAutoLockColors ctLock(colorTable);
|
const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL;
|
||||||
if (!sampler.begin(decodedBitmap, sc, *this, ctLock.colors())) {
|
if (!sampler.begin(decodedBitmap, sc, *this, colors)) {
|
||||||
return kFailure;
|
return kFailure;
|
||||||
}
|
}
|
||||||
const int height = decodedBitmap->height();
|
const int height = decodedBitmap->height();
|
||||||
@ -894,8 +894,8 @@ bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
|
|||||||
even if our decodedBitmap doesn't, due to the request that we
|
even if our decodedBitmap doesn't, due to the request that we
|
||||||
upscale png's palette to a direct model
|
upscale png's palette to a direct model
|
||||||
*/
|
*/
|
||||||
SkAutoLockColors ctLock(colorTable);
|
const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL;
|
||||||
if (!sampler.begin(&decodedBitmap, sc, *this, ctLock.colors())) {
|
if (!sampler.begin(&decodedBitmap, sc, *this, colors)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const int height = decodedBitmap.height();
|
const int height = decodedBitmap.height();
|
||||||
@ -1047,8 +1047,7 @@ static int computeBitDepth(int colorCount) {
|
|||||||
static inline int pack_palette(SkColorTable* ctable,
|
static inline int pack_palette(SkColorTable* ctable,
|
||||||
png_color* SK_RESTRICT palette,
|
png_color* SK_RESTRICT palette,
|
||||||
png_byte* SK_RESTRICT trans, bool hasAlpha) {
|
png_byte* SK_RESTRICT trans, bool hasAlpha) {
|
||||||
SkAutoLockColors alc(ctable);
|
const SkPMColor* SK_RESTRICT colors = ctable ? ctable->readColors() : NULL;
|
||||||
const SkPMColor* SK_RESTRICT colors = alc.colors();
|
|
||||||
const int ctCount = ctable->count();
|
const int ctCount = ctable->count();
|
||||||
int i, num_trans = 0;
|
int i, num_trans = 0;
|
||||||
|
|
||||||
|
@ -621,7 +621,6 @@ bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkAutoLockPixels alp(bm);
|
SkAutoLockPixels alp(bm);
|
||||||
SkAutoLockColors ctLocker;
|
|
||||||
if (NULL == bm.getPixels()) {
|
if (NULL == bm.getPixels()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -638,7 +637,7 @@ bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
|
|||||||
pic.writer = stream_writer;
|
pic.writer = stream_writer;
|
||||||
pic.custom_ptr = (void*)stream;
|
pic.custom_ptr = (void*)stream;
|
||||||
|
|
||||||
const SkPMColor* colors = ctLocker.lockColors(bm);
|
const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : NULL;
|
||||||
const uint8_t* src = (uint8_t*)bm.getPixels();
|
const uint8_t* src = (uint8_t*)bm.getPixels();
|
||||||
const int rgbStride = pic.width * bpp;
|
const int rgbStride = pic.width * bpp;
|
||||||
|
|
||||||
|
@ -98,8 +98,7 @@ bool SkARGBImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkAutoLockColors ctLocker;
|
const SkPMColor* colors = bitmap.getColorTable() ? bitmap.getColorTable()->readColors() : NULL;
|
||||||
const SkPMColor* colors = ctLocker.lockColors(bitmap);
|
|
||||||
|
|
||||||
const int argbStride = bitmap.width() * 4;
|
const int argbStride = bitmap.width() * 4;
|
||||||
SkAutoTDeleteArray<uint8_t> ada(new uint8_t[argbStride]);
|
SkAutoTDeleteArray<uint8_t> ada(new uint8_t[argbStride]);
|
||||||
|
@ -30,7 +30,7 @@ void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s,
|
|||||||
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
||||||
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
|
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
|
||||||
|
|
||||||
const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->lock16BitCache();
|
const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCache();
|
||||||
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
|
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
|
||||||
|
|
||||||
// buffer is y32, x16, x16, x16, x16, x16
|
// buffer is y32, x16, x16, x16, x16, x16
|
||||||
@ -104,8 +104,6 @@ void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s,
|
|||||||
src = srcAddr[*xx++]; *colors++ = table[src];
|
src = srcAddr[*xx++]; *colors++ = table[src];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.fBitmap->getColorTable()->unlock16BitCache();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SI8_opaque_D32_nofilter_DX_arm(
|
void SI8_opaque_D32_nofilter_DX_arm(
|
||||||
@ -121,7 +119,7 @@ void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s,
|
|||||||
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
||||||
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
|
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
|
||||||
|
|
||||||
const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->lockColors();
|
const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors();
|
||||||
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
|
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
|
||||||
|
|
||||||
// buffer is y32, x16, x16, x16, x16, x16
|
// buffer is y32, x16, x16, x16, x16, x16
|
||||||
@ -184,8 +182,6 @@ void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s,
|
|||||||
: "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11"
|
: "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
s.fBitmap->getColorTable()->unlockColors();
|
|
||||||
}
|
}
|
||||||
#endif // !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
|
#endif // !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
|
|||||||
SkASSERT(count > 0 && colors != NULL);
|
SkASSERT(count > 0 && colors != NULL);
|
||||||
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
||||||
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
|
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
|
||||||
const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->lock16BitCache();
|
const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCache();
|
||||||
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
|
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
|
||||||
SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height());
|
SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height());
|
||||||
srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowBytes());
|
srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowBytes());
|
||||||
@ -142,7 +142,6 @@ static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
|
|||||||
src = srcAddr[*xx++]; *colors++ = table[src];
|
src = srcAddr[*xx++]; *colors++ = table[src];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.fBitmap->getColorTable()->unlock16BitCache();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
|
static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
|
||||||
@ -151,7 +150,7 @@ static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
|
|||||||
SkASSERT(count > 0 && colors != NULL);
|
SkASSERT(count > 0 && colors != NULL);
|
||||||
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
|
||||||
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
|
SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel);
|
||||||
const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->lockColors();
|
const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors();
|
||||||
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
|
const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels();
|
||||||
srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowBytes());
|
srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowBytes());
|
||||||
|
|
||||||
@ -363,7 +362,6 @@ static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s,
|
|||||||
"t4", "t5", "t6", "t7", "t8"
|
"t4", "t5", "t6", "t7", "t8"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
s.fBitmap->getColorTable()->unlockColors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we replace a sampleproc, then we null-out the associated shaderproc,
|
/* If we replace a sampleproc, then we null-out the associated shaderproc,
|
||||||
|
Loading…
Reference in New Issue
Block a user