From a6a8f00a3977e71dbce9da50a32c5e9a51c49285 Mon Sep 17 00:00:00 2001 From: reed Date: Mon, 2 Jun 2014 05:45:31 -0700 Subject: [PATCH] hide SkDevice::config() TBR=robertphilips Author: reed@chromium.org Review URL: https://codereview.chromium.org/302253002 --- gyp/skia_for_android_framework_defines.gypi | 1 + gyp/skia_for_chromium_defines.gypi | 1 + include/core/SkBitmapDevice.h | 2 ++ include/core/SkDevice.h | 2 ++ include/gpu/SkGpuDevice.h | 2 ++ src/gpu/GrPictureUtils.cpp | 2 ++ src/gpu/SkGpuDevice.cpp | 2 ++ src/utils/SkDeferredCanvas.cpp | 4 ++++ src/utils/SkGatherPixelRefsAndRects.h | 2 ++ src/utils/SkPictureUtils.cpp | 2 ++ 10 files changed, 20 insertions(+) diff --git a/gyp/skia_for_android_framework_defines.gypi b/gyp/skia_for_android_framework_defines.gypi index 7dc6c97..abcda61 100644 --- a/gyp/skia_for_android_framework_defines.gypi +++ b/gyp/skia_for_android_framework_defines.gypi @@ -14,6 +14,7 @@ # 'skia_for_android_framework_defines': [ 'SK_SUPPORT_LEGACY_SETCONFIG_INFO', + 'SK_SUPPORT_LEGACY_DEVICE_CONFIG', # Needed until we fix skbug.com/2440. 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG', # Transitional, for deprecated SkCanvas::SaveFlags methods. diff --git a/gyp/skia_for_chromium_defines.gypi b/gyp/skia_for_chromium_defines.gypi index 783d352..0f4a3f8 100644 --- a/gyp/skia_for_chromium_defines.gypi +++ b/gyp/skia_for_chromium_defines.gypi @@ -16,6 +16,7 @@ 'SK_SUPPORT_LEGACY_GETTOPDEVICE', 'SK_SUPPORT_LEGACY_ASIMAGEINFO', 'SK_SUPPORT_LEGACY_SETCONFIG_INFO', + 'SK_SUPPORT_LEGACY_DEVICE_CONFIG', 'SK_SUPPORT_LEGACY_N32_NAME', 'SK_IGNORE_CORRECT_HIGH_QUALITY_IMAGE_SCALE', 'SK_SUPPORT_LEGACY_INSTALLPIXELSPARAMS', diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h index 6aeb477..26c0574 100644 --- a/include/core/SkBitmapDevice.h +++ b/include/core/SkBitmapDevice.h @@ -45,9 +45,11 @@ public: */ virtual bool isOpaque() const SK_OVERRIDE { return fBitmap.isOpaque(); } +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG /** Return the bitmap config of the device's pixels */ virtual SkBitmap::Config config() const SK_OVERRIDE { return fBitmap.config(); } +#endif virtual SkImageInfo imageInfo() const SK_OVERRIDE; diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index f8a0c2c..078f7f5 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -82,9 +82,11 @@ public: */ virtual bool isOpaque() const = 0; +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG /** Return the bitmap config of the device's pixels */ virtual SkBitmap::Config config() const = 0; +#endif /** Return the bitmap associated with this device. Call this each time you need to access the bitmap, as it notifies the subclass to perform any flushing diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index d2df32c..f2a27d7 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -82,7 +82,9 @@ public: return NULL == fRenderTarget ? false : kRGB_565_GrPixelConfig == fRenderTarget->config(); } +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG virtual SkBitmap::Config config() const SK_OVERRIDE; +#endif virtual void clear(SkColor color) SK_OVERRIDE; virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE; diff --git a/src/gpu/GrPictureUtils.cpp b/src/gpu/GrPictureUtils.cpp index 30a1d39..f8c2d31 100644 --- a/src/gpu/GrPictureUtils.cpp +++ b/src/gpu/GrPictureUtils.cpp @@ -51,9 +51,11 @@ public: virtual int width() const SK_OVERRIDE { return fInfo.fSize.width(); } virtual int height() const SK_OVERRIDE { return fInfo.fSize.height(); } virtual bool isOpaque() const SK_OVERRIDE { return false; } +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG virtual SkBitmap::Config config() const SK_OVERRIDE { return SkBitmap::kNo_Config; } +#endif virtual SkImageInfo imageInfo() const SK_OVERRIDE { return fEmptyBitmap.info(); } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 59c078f..add0fa7 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -380,6 +380,7 @@ SK_COMPILE_ASSERT(SkShader::kLast_BitmapType == 6, shader_type_mismatch); /////////////////////////////////////////////////////////////////////////////// +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG SkBitmap::Config SkGpuDevice::config() const { if (NULL == fRenderTarget) { return SkBitmap::kNo_Config; @@ -388,6 +389,7 @@ SkBitmap::Config SkGpuDevice::config() const { bool isOpaque; return grConfig2skConfig(fRenderTarget->config(), &isOpaque); } +#endif void SkGpuDevice::clear(SkColor color) { SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp index 9f444e1..a517472 100644 --- a/src/utils/SkDeferredCanvas.cpp +++ b/src/utils/SkDeferredCanvas.cpp @@ -159,7 +159,9 @@ public: virtual int width() const SK_OVERRIDE; virtual int height() const SK_OVERRIDE; +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG virtual SkBitmap::Config config() const SK_OVERRIDE; +#endif virtual bool isOpaque() const SK_OVERRIDE; virtual SkImageInfo imageInfo() const SK_OVERRIDE; @@ -435,9 +437,11 @@ int SkDeferredDevice::height() const { return immediateDevice()->height(); } +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG SkBitmap::Config SkDeferredDevice::config() const { return immediateDevice()->config(); } +#endif bool SkDeferredDevice::isOpaque() const { return immediateDevice()->isOpaque(); diff --git a/src/utils/SkGatherPixelRefsAndRects.h b/src/utils/SkGatherPixelRefsAndRects.h index 4e52ba0..24111dd 100644 --- a/src/utils/SkGatherPixelRefsAndRects.h +++ b/src/utils/SkGatherPixelRefsAndRects.h @@ -38,9 +38,11 @@ public: virtual int width() const SK_OVERRIDE { return fSize.width(); } virtual int height() const SK_OVERRIDE { return fSize.height(); } virtual bool isOpaque() const SK_OVERRIDE { return false; } +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG virtual SkBitmap::Config config() const SK_OVERRIDE { return SkBitmap::kNo_Config; } +#endif virtual SkImageInfo imageInfo() const SK_OVERRIDE { return fEmptyBitmap.info(); } diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index 512b228..4dcb855 100644 --- a/src/utils/SkPictureUtils.cpp +++ b/src/utils/SkPictureUtils.cpp @@ -61,9 +61,11 @@ public: virtual int width() const SK_OVERRIDE { return fSize.width(); } virtual int height() const SK_OVERRIDE { return fSize.height(); } virtual bool isOpaque() const SK_OVERRIDE { return false; } +#ifdef SK_SUPPORT_LEGACY_DEVICE_CONFIG virtual SkBitmap::Config config() const SK_OVERRIDE { return SkBitmap::kNo_Config; } +#endif virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; } virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE { return false; -- 2.7.4