From fc9482933794fb46920abc67cc84923a273e3fe1 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Mon, 7 Apr 2014 21:33:06 +0000 Subject: remove SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG remove SK_SUPPORT_LEGACY_GETDEVICECAPABILITIES BUG=skia: R=robertphillips@google.com, bsalomon@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/227643005 git-svn-id: http://skia.googlecode.com/svn/trunk@14083 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkBitmapDevice.cpp | 27 ------------------- src/core/SkDevice.cpp | 40 ---------------------------- src/gpu/SkGpuDevice.cpp | 64 --------------------------------------------- 3 files changed, 131 deletions(-) (limited to 'src') diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index dd43e963e6..ba529a766b 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -68,33 +68,6 @@ SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& SkASSERT(valid_for_bitmap_device(bitmap.info(), NULL)); } -#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG -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 - fBitmap.setConfig(config, 0, 0, 0, isOpaque ? - kOpaque_SkAlphaType : kPremul_SkAlphaType); - } else if (!isOpaque) { - fBitmap.eraseColor(SK_ColorTRANSPARENT); - } - } -} - -SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque) { - this->init(config, width, height, isOpaque); -} - -SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque, - const SkDeviceProperties& deviceProperties) - : SkBaseDevice(deviceProperties) -{ - this->init(config, width, height, isOpaque); -} -#endif SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo, const SkDeviceProperties* props) { SkImageInfo info = origInfo; diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index be295cec33..255ad02e08 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -33,53 +33,13 @@ SkBaseDevice::~SkBaseDevice() { } SkBaseDevice* SkBaseDevice::createCompatibleDevice(const SkImageInfo& info) { -#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG - // We call the old method to support older subclasses. - // If they have, we return their device, else we use the new impl. - SkBitmap::Config config = SkColorTypeToBitmapConfig(info.colorType()); - SkBaseDevice* dev = this->onCreateCompatibleDevice(config, - info.width(), - info.height(), - info.isOpaque(), - kGeneral_Usage); - if (dev) { - return dev; - } - // fall through to new impl -#endif return this->onCreateDevice(info, kGeneral_Usage); } SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(const SkImageInfo& info) { -#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG - // We call the old method to support older subclasses. - // If they have, we return their device, else we use the new impl. - SkBitmap::Config config = SkColorTypeToBitmapConfig(info.colorType()); - SkBaseDevice* dev = this->onCreateCompatibleDevice(config, - info.width(), - info.height(), - info.isOpaque(), - kSaveLayer_Usage); - if (dev) { - return dev; - } - // fall through to new impl -#endif return this->onCreateDevice(info, kSaveLayer_Usage); } -#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG -SkBaseDevice* SkBaseDevice::createCompatibleDevice(SkBitmap::Config config, - int width, int height, - bool isOpaque) { - SkImageInfo info = SkImageInfo::Make(width, height, - SkBitmapConfigToColorType(config), - isOpaque ? kOpaque_SkAlphaType - : kPremul_SkAlphaType); - return this->createCompatibleDevice(info); -} -#endif - SkMetaData& SkBaseDevice::getMetaData() { // metadata users are rare, so we lazily allocate it. If that changes we // can decide to just make it a field in the device (rather than a ptr) diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index ee4850fa9b..6f6d99140b 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -250,70 +250,6 @@ SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo return SkNEW_ARGS(SkGpuDevice, (context, texture.get())); } -#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG -static SkBitmap make_bitmap(SkBitmap::Config config, int width, int height) { - SkBitmap bm; - bm.setConfig(SkImageInfo::Make(width, height, - SkBitmapConfigToColorType(config), - kPremul_SkAlphaType)); - return bm; -} -SkGpuDevice::SkGpuDevice(GrContext* context, - SkBitmap::Config config, - int width, - int height, - int sampleCount) - : SkBitmapDevice(make_bitmap(config, width, height)) -{ - fDrawProcs = NULL; - - fContext = context; - fContext->ref(); - - fMainTextContext = SkNEW_ARGS(GrDistanceFieldTextContext, (fContext, fLeakyProperties)); - fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, fLeakyProperties)); - - fRenderTarget = NULL; - fNeedClear = false; - - if (config != SkBitmap::kRGB_565_Config) { - config = SkBitmap::kARGB_8888_Config; - } - - GrTextureDesc desc; - desc.fFlags = kRenderTarget_GrTextureFlagBit; - desc.fWidth = width; - desc.fHeight = height; - desc.fConfig = SkBitmapConfig2GrPixelConfig(config); - desc.fSampleCnt = sampleCount; - - SkImageInfo info; - if (!GrPixelConfig2ColorType(desc.fConfig, &info.fColorType)) { - sk_throw(); - } - info.fWidth = width; - info.fHeight = height; - info.fAlphaType = kPremul_SkAlphaType; - - SkAutoTUnref texture(fContext->createUncachedTexture(desc, NULL, 0)); - - if (NULL != texture) { - fRenderTarget = texture->asRenderTarget(); - fRenderTarget->ref(); - - SkASSERT(NULL != fRenderTarget); - - // wrap the bitmap with a pixelref to expose our texture - SkGrPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, texture)); - this->setPixelRef(pr)->unref(); - } else { - GrPrintf("--- failed to create gpu-offscreen [%d %d]\n", - width, height); - SkASSERT(false); - } -} -#endif - SkGpuDevice::~SkGpuDevice() { if (fDrawProcs) { delete fDrawProcs; -- cgit v1.2.3