aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-07 21:33:06 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-07 21:33:06 +0000
commitfc9482933794fb46920abc67cc84923a273e3fe1 (patch)
tree0cd1b1366cf6201d76ce61bc80807d278db359c5
parentc5713e484a1f23d8ce27e801b5970c707a605fb4 (diff)
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
-rw-r--r--experimental/PdfViewer/SkTrackDevice.h11
-rw-r--r--include/core/SkBitmapDevice.h38
-rw-r--r--include/core/SkDevice.h42
-rw-r--r--include/gpu/SkGpuDevice.h10
-rw-r--r--src/core/SkBitmapDevice.cpp27
-rw-r--r--src/core/SkDevice.cpp40
-rw-r--r--src/gpu/SkGpuDevice.cpp64
7 files changed, 0 insertions, 232 deletions
diff --git a/experimental/PdfViewer/SkTrackDevice.h b/experimental/PdfViewer/SkTrackDevice.h
index bb6aace46b..25857f6635 100644
--- a/experimental/PdfViewer/SkTrackDevice.h
+++ b/experimental/PdfViewer/SkTrackDevice.h
@@ -33,17 +33,6 @@ public:
: 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 df4675e5e3..6aeb477537 100644
--- a/include/core/SkBitmapDevice.h
+++ b/include/core/SkBitmapDevice.h
@@ -30,39 +30,6 @@ public:
*/
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 @@ private:
// 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 34d5625c65..e2f676465e 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 @@ public:
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 @@ private:
// 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 ce2ffa11ef..d7d797a102 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -50,16 +50,6 @@ public:
*/
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 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<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;