Remove GetGr() hack.
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 22 Jan 2014 14:43:47 +0000 (14:43 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 22 Jan 2014 14:43:47 +0000 (14:43 +0000)
It seems no GM are using this.

BUG=None
TEST=SampleApp
R=bsalomon@google.com, caryclark@google.com

Author: tfarina@chromium.org

Review URL: https://codereview.chromium.org/144543003

git-svn-id: http://skia.googlecode.com/svn/trunk@13141 2bbb7eff-a529-9590-31e7-b0007b416f81

gm/ninepatchstretch.cpp
samplecode/SampleApp.cpp
samplecode/SampleCode.h

index bc6f13da25a051728e080d574301cf55934a0bb9..94b2d59f281c800a50d90a3283d8be834fc2e28f 100644 (file)
@@ -7,30 +7,14 @@
 
 #include "gm.h"
 
-#if SK_SUPPORT_GPU
-#include "SkGpuDevice.h"
-#else
-class GrContext;
-#endif
-
-static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
-    SkBaseDevice* dev;
-
+static void make_bitmap(SkBitmap* bitmap, SkIRect* center) {
     const int kFixed = 28;
     const int kStretchy = 8;
     const int kSize = 2*kFixed + kStretchy;
 
-#if SK_SUPPORT_GPU
-    if (ctx) {
-        dev = new SkGpuDevice(ctx, SkBitmap::kARGB_8888_Config, kSize, kSize);
-        *bitmap = dev->accessBitmap(false);
-    } else
-#endif
-    {
-        bitmap->setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize);
-        bitmap->allocPixels();
-        dev = new SkBitmapDevice(*bitmap);
-    }
+    bitmap->setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize);
+    bitmap->allocPixels();
+    SkBaseDevice* dev = new SkBitmapDevice(*bitmap);
 
     SkCanvas canvas(dev);
     dev->unref();
@@ -75,7 +59,7 @@ protected:
     virtual void onDraw(SkCanvas* canvas) {
         SkBitmap bm;
         SkIRect center;
-        make_bitmap(&bm, NULL /*SampleCode::GetGr()*/, &center);
+        make_bitmap(&bm, &center);
 
         // amount of bm that should not be stretched (unless we have to)
         const SkScalar fixed = SkIntToScalar(bm.width() - center.width());
index d5fe18217f1cb328ded8c824cbe5d59e01c8191c..127646d0d7ce815ec8ce3209178ec74cdd353db8 100644 (file)
@@ -642,19 +642,6 @@ SkScalar SampleCode::GetAnimSinScalar(SkScalar amplitude,
     return SkScalarMul(amplitude, SkDoubleToScalar(sin(t))) + amplitude;
 }
 
-GrContext* SampleCode::GetGr() {
-    return gSampleWindow ? gSampleWindow->getGrContext() : NULL;
-}
-
-// some GMs rely on having a skiagm::GetGr function defined
-namespace skiagm {
-    // FIXME: this should be moved into a header
-    GrContext* GetGr();
-    GrContext* GetGr() { return SampleCode::GetGr(); }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
 enum TilingMode {
     kNo_Tiling,
     kAbs_128x128_Tiling,
index afca4d2de8155e14b55c9a95662951b3da201b76..7c0452a90ab6e600426d42ea2f2033a0f99fc0be 100644 (file)
@@ -39,8 +39,6 @@ public:
     static SkScalar GetAnimSinScalar(SkScalar amplitude,
                                      SkScalar periodInSec,
                                      SkScalar phaseInSec = 0);
-
-    static GrContext* GetGr();
 };
 
 //////////////////////////////////////////////////////////////////////////////