diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-29 21:10:32 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-29 21:10:32 +0000 |
commit | d0f824cfbd8951bb948b19d7ff5dce028ce557a5 (patch) | |
tree | 4698434f439e248887ed732ce445ca036edb16b3 /src | |
parent | 986d681f3e7a7eb6febd9df9fe21a8d277ba2296 (diff) |
Revert of setConfig -> setInfo (https://codereview.chromium.org/308683005/)
Reason for revert:
broke all Windows bots
Original issue's description:
> setConfig -> setInfo
>
> BUG=skia:
>
> Committed: http://code.google.com/p/skia/source/detail?r=14978
R=robertphillips@google.com, reed@google.com
TBR=reed@google.com, robertphillips@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Author: epoger@google.com
Review URL: https://codereview.chromium.org/302053002
git-svn-id: http://skia.googlecode.com/svn/trunk@14979 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBitmap.cpp | 33 | ||||
-rw-r--r-- | src/core/SkBitmapDevice.cpp | 2 | ||||
-rw-r--r-- | src/core/SkBitmapScaler.cpp | 6 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 2 | ||||
-rw-r--r-- | src/core/SkImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/core/SkReadBuffer.cpp | 2 | ||||
-rw-r--r-- | src/core/SkScalerContext.cpp | 8 | ||||
-rw-r--r-- | src/core/SkValidationUtils.h | 6 | ||||
-rw-r--r-- | src/effects/SkPerlinNoiseShader.cpp | 4 | ||||
-rw-r--r-- | src/effects/gradients/SkGradientShader.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrPictureUtils.cpp | 5 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 4 | ||||
-rw-r--r-- | src/image/SkImagePriv.h | 4 | ||||
-rw-r--r-- | src/image/SkImage_Raster.cpp | 4 | ||||
-rw-r--r-- | src/image/SkSurface_Raster.cpp | 5 | ||||
-rw-r--r-- | src/images/SkImageDecoder_libwebp.cpp | 2 | ||||
-rw-r--r-- | src/images/SkImageRef.cpp | 4 | ||||
-rw-r--r-- | src/lazy/SkCachingPixelRef.cpp | 4 | ||||
-rw-r--r-- | src/lazy/SkDiscardablePixelRef.cpp | 2 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkImageDecoder_CG.cpp | 2 | ||||
-rw-r--r-- | src/utils/SkGatherPixelRefsAndRects.h | 4 | ||||
-rw-r--r-- | src/utils/SkPictureUtils.cpp | 2 | ||||
-rw-r--r-- | src/views/sdl/SkOSWindow_SDL.cpp | 13 |
24 files changed, 70 insertions, 54 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 68874175cd..e5cc0d7fcd 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -202,7 +202,7 @@ static bool validate_alphaType(SkColorType colorType, SkAlphaType alphaType, return true; } -bool SkBitmap::setInfo(const SkImageInfo& origInfo, size_t rowBytes) { +bool SkBitmap::setConfig(const SkImageInfo& origInfo, size_t rowBytes) { SkImageInfo info = origInfo; if (!validate_alphaType(info.fColorType, info.fAlphaType, @@ -241,7 +241,8 @@ bool SkBitmap::setInfo(const SkImageInfo& origInfo, size_t rowBytes) { bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes, SkAlphaType alphaType) { SkColorType ct = SkBitmapConfigToColorType(config); - return this->setInfo(SkImageInfo::Make(width, height, ct, alphaType), rowBytes); + return this->setConfig(SkImageInfo::Make(width, height, ct, alphaType), + rowBytes); } bool SkBitmap::setAlphaType(SkAlphaType alphaType) { @@ -418,7 +419,7 @@ bool SkBitmap::allocPixels(const SkImageInfo& info, SkPixelRefFactory* factory, if (kIndex_8_SkColorType == info.fColorType && NULL == ctable) { return reset_return_false(this); } - if (!this->setInfo(info)) { + if (!this->setConfig(info)) { return reset_return_false(this); } @@ -443,7 +444,7 @@ bool SkBitmap::allocPixels(const SkImageInfo& info, SkPixelRefFactory* factory, bool SkBitmap::installPixels(const SkImageInfo& info, void* pixels, size_t rb, SkColorTable* ct, void (*releaseProc)(void* addr, void* context), void* context) { - if (!this->setInfo(info, rb)) { + if (!this->setConfig(info, rb)) { this->reset(); return false; } @@ -883,8 +884,8 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const { SkPixelRef* pixelRef = fPixelRef->deepCopy(this->config(), &subset); if (pixelRef != NULL) { SkBitmap dst; - dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(), - this->colorType(), this->alphaType())); + dst.setConfig(SkImageInfo::Make(subset.width(), subset.height(), + this->colorType(), this->alphaType())); dst.setIsVolatile(this->isVolatile()); dst.setPixelRef(pixelRef)->unref(); SkDEBUGCODE(dst.validate()); @@ -899,8 +900,8 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const { SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height())); SkBitmap dst; - dst.setInfo(SkImageInfo::Make(r.width(), r.height(), this->colorType(), this->alphaType()), - this->rowBytes()); + dst.setConfig(SkImageInfo::Make(r.width(), r.height(), this->colorType(), this->alphaType()), + this->rowBytes()); dst.setIsVolatile(this->isVolatile()); if (fPixelRef) { @@ -993,7 +994,7 @@ bool SkBitmap::copyTo(SkBitmap* dst, SkColorType dstColorType, dstInfo.fColorType = dstColorType; SkBitmap tmpDst; - if (!tmpDst.setInfo(dstInfo)) { + if (!tmpDst.setConfig(dstInfo)) { return false; } @@ -1101,13 +1102,13 @@ bool SkBitmap::deepCopyTo(SkBitmap* dst) const { // Use the same rowBytes as the original. rowBytes = fRowBytes; } else { - // With the new config, an appropriate fRowBytes will be computed by setInfo. + // With the new config, an appropriate fRowBytes will be computed by setConfig. rowBytes = 0; } SkImageInfo info = fInfo; info.fColorType = dstCT; - if (!dst->setInfo(info, rowBytes)) { + if (!dst->setConfig(info, rowBytes)) { return false; } dst->setPixelRef(pixelRef, fPixelRefOrigin)->unref(); @@ -1217,7 +1218,7 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint, dstM.fRowBytes = SkAlign4(dstM.fBounds.width()); } else { NO_FILTER_CASE: - tmpBitmap.setInfo(SkImageInfo::MakeA8(this->width(), this->height()), srcM.fRowBytes); + tmpBitmap.setConfig(SkImageInfo::MakeA8(this->width(), this->height()), srcM.fRowBytes); if (!tmpBitmap.allocPixels(allocator, NULL)) { // Allocation of pixels for alpha bitmap failed. SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", @@ -1240,8 +1241,8 @@ bool SkBitmap::extractAlpha(SkBitmap* dst, const SkPaint* paint, } SkAutoMaskFreeImage dstCleanup(dstM.fImage); - tmpBitmap.setInfo(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()), - dstM.fRowBytes); + tmpBitmap.setConfig(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()), + dstM.fRowBytes); if (!tmpBitmap.allocPixels(allocator, NULL)) { // Allocation of pixels for alpha bitmap failed. SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", @@ -1331,7 +1332,7 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) { SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewWithData(info, info.minRowBytes(), ctable.get(), data.get())); - bitmap->setInfo(pr->info()); + bitmap->setConfig(pr->info()); bitmap->setPixelRef(pr, 0, 0); return true; } @@ -1355,7 +1356,7 @@ void SkBitmap::legacyUnflatten(SkReadBuffer& buffer) { return; } - bool configIsValid = this->setInfo(info, rowBytes); + bool configIsValid = this->setConfig(info, rowBytes); buffer.validate(configIsValid); int reftype = buffer.readInt(); diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 0f3cc2be50..109943598a 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -78,7 +78,7 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo, SkBitmap bitmap; if (kUnknown_SkColorType == info.colorType()) { - if (!bitmap.setInfo(info)) { + if (!bitmap.setConfig(info)) { return NULL; } } else { diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp index be32a891fc..ebcccf2fe0 100644 --- a/src/core/SkBitmapScaler.cpp +++ b/src/core/SkBitmapScaler.cpp @@ -296,9 +296,9 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr, // Convolve into the result. SkBitmap result; - result.setInfo(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()), - SkScalarCeilToInt(destSubset.height()), - source.alphaType())); + result.setConfig(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()), + SkScalarCeilToInt(destSubset.height()), + source.alphaType())); result.allocPixels(allocator, NULL); if (!result.readyToDraw()) { return false; diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 6ed6a85780..7e10504fbd 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -499,7 +499,7 @@ SkCanvas::SkCanvas(int width, int height) inc_canvas(); SkBitmap bitmap; - bitmap.setInfo(SkImageInfo::MakeUnknown(width, height)); + bitmap.setConfig(SkImageInfo::MakeUnknown(width, height)); this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref(); } diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 6356c1a5dd..582f8992a3 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -309,7 +309,7 @@ SkImageFilter::Cache* SkImageFilter::GetExternalCache() { void SkImageFilter::WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result) { SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); - result->setInfo(info); + result->setConfig(info); result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); } diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp index a3ae8ae9b9..88894d13ab 100644 --- a/src/core/SkReadBuffer.cpp +++ b/src/core/SkReadBuffer.cpp @@ -276,7 +276,7 @@ bool SkReadBuffer::readBitmap(SkBitmap* bitmap) { } } // Could not read the SkBitmap. Use a placeholder bitmap. - bitmap->setInfo(SkImageInfo::MakeUnknown(width, height)); + bitmap->setConfig(SkImageInfo::MakeUnknown(width, height)); return false; } diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index 3e20bf69ed..fee1ff7908 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -584,6 +584,7 @@ static void generateMask(const SkMask& mask, const SkPath& path, matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft), -SkIntToScalar(mask.fBounds.fTop)); + SkBitmap::Config config = SkBitmap::kA8_Config; paint.setAntiAlias(SkMask::kBW_Format != mask.fFormat); switch (mask.fFormat) { case SkMask::kBW_Format: @@ -607,17 +608,18 @@ static void generateMask(const SkMask& mask, const SkPath& path, SkRasterClip clip; clip.setRect(SkIRect::MakeWH(dstW, dstH)); - const SkImageInfo info = SkImageInfo::MakeA8(dstW, dstH); SkBitmap bm; + bm.setConfig(config, dstW, dstH, dstRB); if (0 == dstRB) { - if (!bm.allocPixels(info)) { + if (!bm.allocPixels()) { // can't allocate offscreen, so empty the mask and return sk_bzero(mask.fImage, mask.computeImageSize()); return; } + bm.lockPixels(); } else { - bm.installPixels(info, mask.fImage, dstRB); + bm.setPixels(mask.fImage); } sk_bzero(bm.getPixels(), bm.getSafeSize()); diff --git a/src/core/SkValidationUtils.h b/src/core/SkValidationUtils.h index e9e59866ca..683da29c18 100644 --- a/src/core/SkValidationUtils.h +++ b/src/core/SkValidationUtils.h @@ -23,6 +23,12 @@ static inline bool SkIsValidMode(SkXfermode::Mode mode) { return (mode >= 0) && (mode <= SkXfermode::kLastMode); } +/** Returns true if config's value is in the SkBitmap::Config enum. + */ +static inline bool SkIsValidConfig(SkBitmap::Config config) { + return (config >= 0) && (config <= static_cast<int>(SkBitmap::kConfigCount)); +} + /** Returns true if the rect's dimensions are between 0 and SK_MaxS32 */ static inline bool SkIsValidIRect(const SkIRect& rect) { diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index a37dff5cda..68645540ca 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -92,10 +92,10 @@ struct SkPerlinNoiseShader::PaintingData { } #if SK_SUPPORT_GPU && !defined(SK_USE_SIMPLEX_NOISE) - fPermutationsBitmap.setInfo(SkImageInfo::MakeA8(kBlockSize, 1)); + fPermutationsBitmap.setConfig(SkImageInfo::MakeA8(kBlockSize, 1)); fPermutationsBitmap.setPixels(fLatticeSelector); - fNoiseBitmap.setInfo(SkImageInfo::MakeN32Premul(kBlockSize, 4)); + fNoiseBitmap.setConfig(SkImageInfo::MakeN32Premul(kBlockSize, 4)); fNoiseBitmap.setPixels(fNoise[0][0]); #endif } diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 038044d561..ada9859017 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -619,7 +619,7 @@ void SkGradientShaderBase::getGradientTableBitmap(SkBitmap* bitmap) const { if (!gCache->find(storage.get(), size, bitmap)) { // force our cahce32pixelref to be built (void)cache->getCache32(); - bitmap->setInfo(SkImageInfo::MakeN32Premul(kCache32Count, 1)); + bitmap->setConfig(SkImageInfo::MakeN32Premul(kCache32Count, 1)); bitmap->setPixelRef(cache->getCache32PixelRef()); gCache->add(storage.get(), size, *bitmap); diff --git a/src/gpu/GrPictureUtils.cpp b/src/gpu/GrPictureUtils.cpp index 30a1d39a3c..84a13be466 100644 --- a/src/gpu/GrPictureUtils.cpp +++ b/src/gpu/GrPictureUtils.cpp @@ -41,7 +41,10 @@ public: fInfo.fHasNestedLayers = false; fInfo.fIsNested = (2 == fSaveLayerDepth); - fEmptyBitmap.setInfo(SkImageInfo::MakeUnknown(fInfo.fSize.fWidth, fInfo.fSize.fHeight)); + fEmptyBitmap.setConfig(SkImageInfo::Make(fInfo.fSize.fWidth, + fInfo.fSize.fHeight, + kUnknown_SkColorType, + kIgnore_SkAlphaType)); fAccelData = accelData; fAlreadyDrawn = false; } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 2e62647293..431238b9db 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -738,7 +738,7 @@ SkBitmap wrap_texture(GrTexture* texture) { texture->asImageInfo(&info); SkBitmap result; - result.setInfo(info); + result.setConfig(info); result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); return result; } @@ -1818,7 +1818,7 @@ void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) { static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* result) { SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); - result->setInfo(info); + result->setConfig(info); result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); } diff --git a/src/image/SkImagePriv.h b/src/image/SkImagePriv.h index 031832bd0d..9f9cd12f69 100644 --- a/src/image/SkImagePriv.h +++ b/src/image/SkImagePriv.h @@ -11,6 +11,8 @@ #include "SkBitmap.h" #include "SkImage.h" +extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&); + // Call this if you explicitly want to use/share this pixelRef in the image extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, size_t rowBytes); @@ -21,7 +23,7 @@ extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, * be shared if either the bitmap is marked as immutable, or canSharePixelRef * is true. * - * If the bitmap's colortype cannot be converted into a corresponding + * If the bitmap's config cannot be converted into a corresponding * SkImageInfo, or the bitmap's pixels cannot be accessed, this will return * NULL. */ diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp index 68fc1b32e6..3be7d84b7f 100644 --- a/src/image/SkImage_Raster.cpp +++ b/src/image/SkImage_Raster.cpp @@ -31,7 +31,7 @@ public: return false; } - if (kUnknown_SkColorType == info.colorType()) { + if (SkImageInfoToBitmapConfig(info) == SkBitmap::kNo_Config) { return false; } @@ -104,7 +104,7 @@ SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes) SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes) : INHERITED(info.fWidth, info.fHeight) { - fBitmap.setInfo(info, rowBytes); + fBitmap.setConfig(info, rowBytes); fBitmap.setPixelRef(pr); fBitmap.lockPixels(); } diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp index 0b6efe19fe..74197379ce 100644 --- a/src/image/SkSurface_Raster.cpp +++ b/src/image/SkSurface_Raster.cpp @@ -79,7 +79,8 @@ bool SkSurface_Raster::Valid(const SkImageInfo& info, size_t rowBytes) { SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t rb) : INHERITED(info) { - fBitmap.installPixels(info, pixels, rb); + fBitmap.setConfig(info, rb); + fBitmap.setPixels(pixels); fWeOwnThePixels = false; // We are "Direct" } @@ -88,7 +89,7 @@ SkSurface_Raster::SkSurface_Raster(SkPixelRef* pr) { const SkImageInfo& info = pr->info(); - fBitmap.setInfo(info, info.minRowBytes()); + fBitmap.setConfig(info, info.minRowBytes()); fBitmap.setPixelRef(pr); fWeOwnThePixels = true; diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp index 353eabf015..02990258eb 100644 --- a/src/images/SkImageDecoder_libwebp.cpp +++ b/src/images/SkImageDecoder_libwebp.cpp @@ -311,7 +311,7 @@ bool SkWEBPImageDecoder::setDecodeConfig(SkBitmap* decodedBitmap, } else { info.fAlphaType = kOpaque_SkAlphaType; } - return decodedBitmap->setInfo(info); + return decodedBitmap->setConfig(info); } bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, diff --git a/src/images/SkImageRef.cpp b/src/images/SkImageRef.cpp index 2cb8ec82ba..458aa2aa5a 100644 --- a/src/images/SkImageRef.cpp +++ b/src/images/SkImageRef.cpp @@ -32,7 +32,7 @@ SkImageRef::SkImageRef(const SkImageInfo& info, SkStreamRewindable* stream, // This sets the colortype/alphatype to exactly match our info, so that this // can get communicated down to the codec. - fBitmap.setInfo(info); + fBitmap.setConfig(info); #ifdef DUMP_IMAGEREF_LIFECYCLE SkDebugf("add ImageRef %p [%d] data=%d\n", @@ -190,7 +190,7 @@ SkImageRef::SkImageRef(SkReadBuffer& buffer, SkBaseMutex* mutex) // This sets the colortype/alphatype to exactly match our info, so that this // can get communicated down to the codec. - fBitmap.setInfo(this->info()); + fBitmap.setConfig(this->info()); } void SkImageRef::flatten(SkWriteBuffer& buffer) const { diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp index 76510f63cd..f1510fb67c 100644 --- a/src/lazy/SkCachingPixelRef.cpp +++ b/src/lazy/SkCachingPixelRef.cpp @@ -14,7 +14,7 @@ bool SkCachingPixelRef::Install(SkImageGenerator* generator, SkASSERT(dst != NULL); if ((NULL == generator) || !(generator->getInfo(&info)) - || !dst->setInfo(info)) { + || !dst->setConfig(info, 0)) { SkDELETE(generator); return false; } @@ -54,7 +54,7 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) { &bitmap); if (NULL == fScaledCacheId) { // Cache has been purged, must re-decode. - if ((!bitmap.setInfo(info, fRowBytes)) || !bitmap.allocPixels()) { + if ((!bitmap.setConfig(info, fRowBytes)) || !bitmap.allocPixels()) { fErrorInDecoding = true; return false; } diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp index f0d7affdc8..53e9d1ab62 100644 --- a/src/lazy/SkDiscardablePixelRef.cpp +++ b/src/lazy/SkDiscardablePixelRef.cpp @@ -102,7 +102,7 @@ bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst, SkAutoTDelete<SkImageGenerator> autoGenerator(generator); if ((NULL == autoGenerator.get()) || (!autoGenerator->getInfo(&info)) - || (!dst->setInfo(info))) { + || (!dst->setConfig(info, 0))) { return false; } SkASSERT(dst->colorType() != kUnknown_SkColorType); diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index ab4d71d37f..e5402a021c 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -725,7 +725,7 @@ static inline SkBitmap makeContentBitmap(const SkISize& contentSize, } SkBitmap bitmap; - bitmap.setInfo(info); + bitmap.setConfig(info); return bitmap; } diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp index a21536b111..fe22ea0e76 100644 --- a/src/ports/SkImageDecoder_CG.cpp +++ b/src/ports/SkImageDecoder_CG.cpp @@ -70,7 +70,7 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { const int height = SkToInt(CGImageGetHeight(image)); SkImageInfo skinfo = SkImageInfo::MakeN32Premul(width, height); - bm->setInfo(skinfo); + bm->setConfig(skinfo); if (SkImageDecoder::kDecodeBounds_Mode == mode) { return true; } diff --git a/src/utils/SkGatherPixelRefsAndRects.h b/src/utils/SkGatherPixelRefsAndRects.h index 4e52ba07c8..894b8f0fde 100644 --- a/src/utils/SkGatherPixelRefsAndRects.h +++ b/src/utils/SkGatherPixelRefsAndRects.h @@ -28,7 +28,9 @@ public: fSize.set(width, height); fPRCont = prCont; SkSafeRef(fPRCont); - fEmptyBitmap.setInfo(SkImageInfo::MakeUnknown(width, height)); + fEmptyBitmap.setConfig(SkImageInfo::Make(width, height, + kUnknown_SkColorType, + kIgnore_SkAlphaType)); } virtual ~SkGatherPixelRefsAndRectsDevice() { diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index 512b228a49..fc1611d288 100644 --- a/src/utils/SkPictureUtils.cpp +++ b/src/utils/SkPictureUtils.cpp @@ -54,7 +54,7 @@ public: GatherPixelRefDevice(int width, int height, PixelRefSet* prset) { fSize.set(width, height); - fEmptyBitmap.setInfo(SkImageInfo::MakeUnknown(width, height)); + fEmptyBitmap.setConfig(SkImageInfo::MakeUnknown(width, height)); fPRSet = prset; } diff --git a/src/views/sdl/SkOSWindow_SDL.cpp b/src/views/sdl/SkOSWindow_SDL.cpp index 27783d41fc..2a1fae28a6 100644 --- a/src/views/sdl/SkOSWindow_SDL.cpp +++ b/src/views/sdl/SkOSWindow_SDL.cpp @@ -23,23 +23,22 @@ static void post_SkEvent_event() { } static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) { - SkColorType ct; - SkAlphaType at; + SkBitmap::Config config; switch (src->format->BytesPerPixel) { case 2: - ct = kRGB_565_SkColorType; - at = kOpaque_SkAlphaType; + config = SkBitmap::kRGB_565_Config; break; case 4: - ct = kN32_SkColorType; - at = kPremul_SkAlphaType; + config = SkBitmap::kARGB_8888_Config; break; default: return false; } - return dst->installPixels(SkImageInfo::Make(src->w, src->h, ct, at), src->pixels, src->pitch); + dst->setConfig(config, src->w, src->h, src->pitch); + dst->setPixels(src->pixels); + return true; } SkOSWindow::SkOSWindow(void* screen) { |