aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/ninepatchstretch.cpp
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-23 18:14:13 +0000
commitd6176b0dcacb124539e0cfd051e6d93a9782f020 (patch)
tree9e6f4b465e54c9b26e1ba70cd8890b55abb08464 /gm/ninepatchstretch.cpp
parentfbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (diff)
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6474054 git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/ninepatchstretch.cpp')
-rw-r--r--gm/ninepatchstretch.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index 226649dc15..fde5b6c3ae 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -16,7 +16,7 @@ class GrContext;
static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
SkDevice* dev;
SkCanvas canvas;
-
+
const int kFixed = 28;
const int kStretchy = 8;
const int kSize = 2*kFixed + kStretchy;
@@ -32,19 +32,19 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
bitmap->allocPixels();
dev = new SkDevice(*bitmap);
}
-
+
canvas.setDevice(dev)->unref();
canvas.clear(0);
-
+
SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize));
const SkScalar strokeWidth = SkIntToScalar(6);
const SkScalar radius = SkIntToScalar(kFixed) - strokeWidth/2;
-
+
center->setXYWH(kFixed, kFixed, kStretchy, kStretchy);
-
+
SkPaint paint;
paint.setAntiAlias(true);
-
+
paint.setColor(0xFFFF0000);
canvas.drawRoundRect(r, radius, radius, paint);
r.setXYWH(SkIntToScalar(kFixed), 0, SkIntToScalar(kStretchy), SkIntToScalar(kSize));
@@ -56,19 +56,19 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
}
namespace skiagm {
-
+
class NinePatchStretchGM : public GM {
public:
SkBitmap fBM;
- NinePatchStretchGM() {}
+ NinePatchStretchGM() {}
protected:
virtual SkString onShortName() {
return SkString("ninepatch-stretch");
}
- virtual SkISize onISize() {
+ virtual SkISize onISize() {
return make_isize(400, 400);
}
@@ -76,25 +76,25 @@ protected:
SkBitmap bm;
SkIRect center;
make_bitmap(&bm, NULL /*SampleCode::GetGr()*/, &center);
-
+
// amount of bm that should not be stretched (unless we have to)
const SkScalar fixed = SkIntToScalar(bm.width() - center.width());
-
+
const SkTSize<SkScalar> size[] = {
{ fixed * 4 / 5, fixed * 4 / 5 }, // shrink in both axes
{ fixed * 4 / 5, fixed * 4 }, // shrink in X
{ fixed * 4, fixed * 4 / 5 }, // shrink in Y
{ fixed * 4, fixed * 4 }
};
-
+
canvas->drawBitmap(bm, SkIntToScalar(10), SkIntToScalar(10), NULL);
-
+
SkScalar x = SkIntToScalar(100);
SkScalar y = SkIntToScalar(100);
-
+
SkPaint paint;
paint.setFilterBitmap(true);
-
+
for (int iy = 0; iy < 2; ++iy) {
for (int ix = 0; ix < 2; ++ix) {
int i = ix * 2 + iy;
@@ -104,7 +104,7 @@ protected:
}
}
}
-
+
private:
typedef GM INHERITED;
};