diff options
Diffstat (limited to 'samplecode/SampleNinePatch.cpp')
-rw-r--r-- | samplecode/SampleNinePatch.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/samplecode/SampleNinePatch.cpp b/samplecode/SampleNinePatch.cpp index bab7b232cc..4286ed3e70 100644 --- a/samplecode/SampleNinePatch.cpp +++ b/samplecode/SampleNinePatch.cpp @@ -5,10 +5,16 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ + #include "SampleCode.h" #include "SkCanvas.h" +#include "SkDevice.h" #include "SkPaint.h" +#if SK_SUPPORT_GPU #include "SkGpuDevice.h" +#else +class GrContext; +#endif static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) { SkDevice* dev; @@ -18,10 +24,13 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) { 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 { + } else +#endif + { bitmap->setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize); bitmap->allocPixels(); dev = new SkDevice(*bitmap); @@ -52,7 +61,7 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) { class NinePatchView : public SampleView { public: - NinePatchView() {} + NinePatchView() {} protected: // overrides from SkEventSink |