tweaks for nov demo

Add this flag to SampleApp, and it will run with the specified restricted sequence

    --sequence /skia/trunk/resources/nov-talk-sequence.txt

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1410243009
This commit is contained in:
reed 2015-11-09 08:36:05 -08:00 committed by Commit bot
parent 6f797092d2
commit 73f6cfc181
2 changed files with 38 additions and 6 deletions

View File

@ -1,4 +1,10 @@
Arcs
GM:aaclip
GM:xfermodes
GM:addarc
DrawAtlasSim
DrawAtlas
DrawShipSim
DrawShip
PerlinPatch
FilterQuality
GM:xfermodes2
GM:aaxfermodes
GM:colortype
AnimatedText

View File

@ -12,6 +12,8 @@
#include "SkAnimTimer.h"
#include "SkCanvas.h"
#include "SkInterpolator.h"
#include "SkGradientShader.h"
#include "SkData.h"
#include "SkPath.h"
#include "SkSurface.h"
#include "SkRandom.h"
@ -25,6 +27,27 @@ static SkSurface* make_surface(SkCanvas* canvas, const SkImageInfo& info) {
return surface;
}
static SkShader* make_shader(const SkRect& bounds) {
#if 0
const SkPoint pts[] = {
{ bounds.left(), bounds.top() },
{ bounds.right(), bounds.bottom() },
};
const SkColor colors[] = {
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorBLACK,
SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW,
};
return SkGradientShader::CreateLinear(pts,
colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode);
#else
SkString resourcePath = GetResourcePath("mandrill_128.png");
SkAutoTUnref<SkData> data(SkData::NewFromFileName(resourcePath.c_str()));
SkAutoTUnref<SkImage> image(SkImage::NewFromEncoded(data));
return image->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
#endif
}
#define N 128
#define ANGLE_DELTA 3
#define SCALE_DELTA (SK_Scalar1 / 32)
@ -42,12 +65,15 @@ static SkImage* make_image() {
path.addRect(SkRect::MakeWH(N, N/2));
path.moveTo(0, 0); path.lineTo(N, 0); path.lineTo(0, N); path.close();
canvas->drawPath(path, SkPaint());
SkPaint paint;
paint.setShader(make_shader(SkRect::MakeWH(N, N)))->unref();
canvas->drawPath(path, paint);
return surface->newImageSnapshot();
}
static SkImage* zoom_up(SkSurface* origSurf, SkImage* orig) {
const SkScalar S = 8; // amount to scale up
const SkScalar S = 16; // amount to scale up
const int D = 2; // dimension scaling for the offscreen
// since we only view the center, don't need to produce the entire thing