retool without shapes, which are broken/experimental
git-svn-id: http://skia.googlecode.com/svn/trunk@1436 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
c0c4d22bac
commit
e3605d0e74
@ -1,32 +1,29 @@
|
||||
#include "gm.h"
|
||||
#include "SkPicture.h"
|
||||
#include "SkRectShape.h"
|
||||
#include "SkBlurDrawLooper.h"
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ShadowsGM : public GM {
|
||||
static void setup(SkPaint* paint, SkColor c, SkScalar strokeWidth) {
|
||||
paint->setColor(c);
|
||||
if (strokeWidth < 0) {
|
||||
paint->setStyle(SkPaint::kFill_Style);
|
||||
} else {
|
||||
paint->setStyle(SkPaint::kStroke_Style);
|
||||
paint->setStrokeWidth(strokeWidth);
|
||||
}
|
||||
}
|
||||
|
||||
class ShadowsGM : public GM {
|
||||
public:
|
||||
SkPath fCirclePath;
|
||||
SkPaint fPaint;
|
||||
SkRectShape fRectShape;
|
||||
SkRect fRect;
|
||||
|
||||
ShadowsGM() {
|
||||
fCirclePath.addCircle(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(10) );
|
||||
fPaint.setStrokeWidth(SkIntToScalar(4));
|
||||
fPaint.setAntiAlias(true);
|
||||
fPaint.setColor(0xFF00FF00);
|
||||
fPaint.setStyle(SkPaint::kStroke_Style);
|
||||
SkRect rect;
|
||||
rect.set(SkIntToScalar(10), SkIntToScalar(10),
|
||||
SkIntToScalar(30), SkIntToScalar(30));
|
||||
fRectShape.setRect(rect);
|
||||
fRectShape.paint().setColor(SK_ColorRED);
|
||||
}
|
||||
|
||||
virtual ~ShadowsGM() {
|
||||
fRect.set(SkIntToScalar(10), SkIntToScalar(10),
|
||||
SkIntToScalar(30), SkIntToScalar(30));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -80,15 +77,28 @@ protected:
|
||||
SkBlurDrawLooper::kHighQuality_BlurFlag );
|
||||
SkAutoUnref aurL4(shadowLoopers[4]);
|
||||
|
||||
for (int looper = 0; looper < 5; looper ++)
|
||||
{
|
||||
fRectShape.paint().setLooper(shadowLoopers[looper]);
|
||||
canvas->resetMatrix();
|
||||
canvas->translate(SkIntToScalar(looper*40), SkIntToScalar(0));
|
||||
canvas->drawShape(&fRectShape);
|
||||
fPaint.setLooper(shadowLoopers[looper]);
|
||||
static const struct {
|
||||
SkColor fColor;
|
||||
SkScalar fStrokeWidth;
|
||||
} gRec[] = {
|
||||
{ SK_ColorRED, -SK_Scalar1 },
|
||||
{ SK_ColorGREEN, SkIntToScalar(4) },
|
||||
};
|
||||
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(shadowLoopers); ++i) {
|
||||
SkAutoCanvasRestore acr(canvas, true);
|
||||
|
||||
paint.setLooper(shadowLoopers[i]);
|
||||
|
||||
canvas->translate(SkIntToScalar(i*40), SkIntToScalar(0));
|
||||
setup(&paint, gRec[0].fColor, gRec[0].fStrokeWidth);
|
||||
canvas->drawRect(fRect, paint);
|
||||
|
||||
canvas->translate(SkIntToScalar(0), SkIntToScalar(40));
|
||||
canvas->drawPath(fCirclePath, fPaint);
|
||||
setup(&paint, gRec[1].fColor, gRec[1].fStrokeWidth);
|
||||
canvas->drawPath(fCirclePath, paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user