void* fPixels;
SkColorTable* fColorTable;
size_t fRowBytes;
-
+
void zero() { sk_bzero(this, sizeof(*this)); }
bool isZero() const {
return NULL == fPixels && NULL == fColorTable && 0 == fRowBytes;
}
};
-
+
/**
* Returns true if the lockcount > 0
*/
void SkBitmapDevice::init(SkBitmap::Config config, int width, int height, bool isOpaque) {
fBitmap.setConfig(config, width, height, 0, isOpaque ?
kOpaque_SkAlphaType : kPremul_SkAlphaType);
-
+
if (SkBitmap::kNo_Config != config) {
if (!fBitmap.allocPixels()) {
// indicate failure by zeroing our bitmap
fCTable = ctable;
fRB = rowBytes;
SkSafeRef(ctable);
-
+
this->setPreLocked(fStorage, fRB, fCTable);
}
bool SkPixelRef::lockPixels(LockRec* rec) {
SkASSERT(!fPreLocked || SKPIXELREF_PRELOCKED_LOCKCOUNT == fLockCount);
-
+
if (!fPreLocked) {
SkAutoMutexAcquire ac(*fMutex);
-
+
if (1 == ++fLockCount) {
SkASSERT(fRec.isZero());
if (fErrorInDecoding) {
return false; // don't try again.
}
-
+
const SkImageInfo& info = this->info();
SkBitmap bitmap;
SkASSERT(NULL == fScaledCacheId);
SkAutoLockPixels autoLockPixels(bitmap);
void* pixels = bitmap.getPixels();
SkASSERT(pixels != NULL);
-
+
// At this point, the autoLockPixels will unlockPixels()
// to remove bitmap's lock on the pixels. We will then
// destroy bitmap. The *only* guarantee that this pointer
SkDELETE(fDiscardableMemory);
fDiscardableMemory = NULL;
}
-
+
const size_t size = this->info().getSafeSize(fRowBytes);
if (fDMFactory != NULL) {