Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: gm/ninepatchstretch.cpp

Issue 144543003: Remove GetGr() hack. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | samplecode/SampleApp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/ninepatchstretch.cpp
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index bc6f13da25a051728e080d574301cf55934a0bb9..94b2d59f281c800a50d90a3283d8be834fc2e28f 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -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());
« no previous file with comments | « no previous file | samplecode/SampleApp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698