#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();
virtual void onDraw(SkCanvas* canvas) {
SkBitmap bm;
SkIRect center;
- make_bitmap(&bm, NULL /*SampleCode::GetGr()*/, ¢er);
+ make_bitmap(&bm, ¢er);
// amount of bm that should not be stretched (unless we have to)
const SkScalar fixed = SkIntToScalar(bm.width() - center.width());
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,
static SkScalar GetAnimSinScalar(SkScalar amplitude,
SkScalar periodInSec,
SkScalar phaseInSec = 0);
-
- static GrContext* GetGr();
};
//////////////////////////////////////////////////////////////////////////////