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
diff --git a/experimental/PdfViewer/SkTrackDevice.h b/experimental/PdfViewer/SkTrackDevice.h
index bb6aace..25857f6 100644
--- a/experimental/PdfViewer/SkTrackDevice.h
+++ b/experimental/PdfViewer/SkTrackDevice.h
@@ -33,17 +33,6 @@
         : SkBitmapDevice(bitmap, deviceProperties)
         , fTracker(NULL) {}
 
-#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
-    SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false)
-        : SkBitmapDevice(config, width, height, isOpaque)
-        , fTracker(NULL) {}
-
-    SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
-                  const SkDeviceProperties& deviceProperties)
-        : SkBitmapDevice(config, width, height, isOpaque, deviceProperties)
-        , fTracker(NULL) {}
-#endif
-
     virtual ~SkTrackDevice() {}
 
     // Install a tracker - we can reuse the tracker between multiple devices, and the state of the
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h
index df4675e..6aeb477 100644
--- a/include/core/SkBitmapDevice.h
+++ b/include/core/SkBitmapDevice.h
@@ -30,39 +30,6 @@
     */
     SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties);
 
-#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
-    /**
-     *  Create a new raster device and have the pixels be automatically
-     *  allocated. The rowBytes of the device will be computed automatically
-     *  based on the config and the width.
-     *
-     *  @param config   The desired config for the pixels. If the request cannot
-     *                  be met, the closest matching support config will be used.
-     *  @param width    width (in pixels) of the device
-     *  @param height   height (in pixels) of the device
-     *  @param isOpaque Set to true if it is known that all of the pixels will
-     *                  be drawn to opaquely. Used as an accelerator when drawing
-     *                  these pixels to another device.
-     */
-    SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false);
-
-    /**
-     *  Create a new raster device and have the pixels be automatically
-     *  allocated. The rowBytes of the device will be computed automatically
-     *  based on the config and the width.
-     *
-     *  @param config   The desired config for the pixels. If the request cannot
-     *                  be met, the closest matching support config will be used.
-     *  @param width    width (in pixels) of the device
-     *  @param height   height (in pixels) of the device
-     *  @param isOpaque Set to true if it is known that all of the pixels will
-     *                  be drawn to opaquely. Used as an accelerator when drawing
-     *                  these pixels to another device.
-     *  @param deviceProperties Properties which affect compositing.
-     */
-    SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
-                   const SkDeviceProperties& deviceProperties);
-#endif
     static SkBitmapDevice* Create(const SkImageInfo&,
                                   const SkDeviceProperties* = NULL);
 
@@ -240,11 +207,6 @@
     // any clip information.
     virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE;
 
-#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
-    // in support of legacy constructors
-    void init(SkBitmap::Config config, int width, int height, bool isOpaque);
-#endif
-
     virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
 
     /** Causes any deferred drawing to the device to be completed.
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 34d5625..e2f6764 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -17,13 +17,6 @@
 #include "SkDeviceProperties.h"
 #include "SkImageFilter.h"
 
-// getDeviceCapabilities() is not called by skia, but this flag keeps it around
-// for clients that have "override" annotations on their subclass. These overrides
-// should be deleted.
-//#define SK_SUPPORT_LEGACY_GETDEVICECAPABILITIES
-
-//#define SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
-
 class SkClipStack;
 class SkDraw;
 struct SkIRect;
@@ -49,33 +42,10 @@
 
     virtual ~SkBaseDevice();
 
-#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
-    /**
-     *  Creates a device that is of the same type as this device (e.g. SW-raster,
-     *  GPU, or PDF). The backing store for this device is created automatically
-     *  (e.g. offscreen pixels or FBO or whatever is appropriate).
-     *
-     *  @param width    width of the device to create
-     *  @param height   height of the device to create
-     *  @param isOpaque performance hint, set to true if you know that you will
-     *                  draw into this device such that all of the pixels will
-     *                  be opaque.
-     */
-    SkBaseDevice* createCompatibleDevice(SkBitmap::Config config,
-                                         int width, int height,
-                                         bool isOpaque);
-#endif
     SkBaseDevice* createCompatibleDevice(const SkImageInfo&);
 
     SkMetaData& getMetaData();
 
-#ifdef SK_SUPPORT_LEGACY_GETDEVICECAPABILITIES
-    enum Capabilities {
-        kVector_Capability = 0x1,
-    };
-    virtual uint32_t getDeviceCapabilities() { return 0; }
-#endif
-
     /** Return the width of the device (in pixels).
     */
     virtual int width() const = 0;
@@ -407,18 +377,6 @@
     // just called by SkCanvas for saveLayer
     SkBaseDevice* createCompatibleDeviceForSaveLayer(const SkImageInfo&);
 
-#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
-    /**
-     * Justs exists during the period where clients still "override" this
-     *  signature. They are supported by our base-impl calling this old
-     *  signature from the new one (using ImageInfo).
-     */
-    virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
-                                                   int width, int height,
-                                                   bool isOpaque, Usage) {
-        return NULL;
-    }
-#endif
     virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) {
         return NULL;
     }
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index ce2ffa1..d7d797a 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -50,16 +50,6 @@
      */
     static SkGpuDevice* Create(GrContext*, const SkImageInfo&, int sampleCount);
 
-#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
-    /**
-     *  New device that will create an offscreen renderTarget based on the
-     *  config, width, height, and sampleCount. The device's storage will not
-     *  count against the GrContext's texture cache budget. The device's pixels
-     *  will be uninitialized. TODO: This can fail, replace with a factory function.
-     */
-    SkGpuDevice(GrContext*, SkBitmap::Config, int width, int height, int sampleCount = 0);
-#endif
-
     /**
      *  DEPRECATED -- need to make this private, call Create(surface)
      *  New device that will render to the specified renderTarget.
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index dd43e96..ba529a7 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -68,33 +68,6 @@
     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 be295ce..255ad02 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -33,53 +33,13 @@
 }
 
 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 ee4850f..6f6d991 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -250,70 +250,6 @@
     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<GrTexture> 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;