Style bikeshed - remove extraneous whitespace
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842753002 Review URL: https://codereview.chromium.org/1842753002
This commit is contained in:
parent
e577693b3b
commit
9d524f22bf
@ -84,4 +84,3 @@ DEF_BENCH( return new BigPathBench(kRight_Align, false); )
|
||||
DEF_BENCH( return new BigPathBench(kLeft_Align, true); )
|
||||
DEF_BENCH( return new BigPathBench(kMiddle_Align, true); )
|
||||
DEF_BENCH( return new BigPathBench(kRight_Align, true); )
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define BLUR_SIGMA_LARGE 10.0f
|
||||
#define BLUR_SIGMA_HUGE 80.0f
|
||||
|
||||
|
||||
|
||||
// When 'cropped' is set we apply a cropRect to the blurImageFilter. The crop rect is an inset of
|
||||
// the source's natural dimensions. This is intended to exercise blurring a larger source bitmap
|
||||
// to a smaller destination bitmap.
|
||||
|
@ -92,7 +92,7 @@ protected:
|
||||
SkMask mask;
|
||||
if (!SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()),
|
||||
&mask, r, kNormal_SkBlurStyle)) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
SkMask::FreeImage(mask.fImage);
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -34,4 +34,3 @@ SkIPoint GMBench::onGetSize() {
|
||||
SkISize size = fGM->getISize();
|
||||
return SkIPoint::Make(size.fWidth, size.fHeight);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ protected:
|
||||
class GeoRectBench_Intersects : public GeoRectBench {
|
||||
public:
|
||||
GeoRectBench_Intersects() : GeoRectBench("rect_Intersects") {}
|
||||
|
||||
|
||||
protected:
|
||||
void onDraw(int loops, SkCanvas* canvas) override {
|
||||
for (int outer = 0; outer < loops; ++outer) {
|
||||
@ -113,7 +113,7 @@ protected:
|
||||
class GeoRectBench_sort : public GeoRectBench {
|
||||
public:
|
||||
GeoRectBench_sort() : GeoRectBench("rect_sort") {}
|
||||
|
||||
|
||||
protected:
|
||||
void onDraw(int loops, SkCanvas* canvas) override {
|
||||
for (int outer = 0; outer < loops; ++outer) {
|
||||
@ -243,4 +243,3 @@ protected:
|
||||
}
|
||||
};
|
||||
DEF_BENCH( return new ChopCubicAt; )
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
@ -298,4 +297,3 @@ DEF_BENCH( return new MapPointsMatrixBench("mappoints_identity", SkMatrix::I());
|
||||
DEF_BENCH( return new MapPointsMatrixBench("mappoints_trans", make_trans()); )
|
||||
DEF_BENCH( return new MapPointsMatrixBench("mappoints_scale", make_scale()); )
|
||||
DEF_BENCH( return new MapPointsMatrixBench("mappoints_affine", make_afine()); )
|
||||
|
||||
|
@ -55,4 +55,3 @@ private:
|
||||
|
||||
DEF_BENCH( return new ChunkAllocBench(64); )
|
||||
DEF_BENCH( return new ChunkAllocBench(8*1024); )
|
||||
|
||||
|
@ -65,4 +65,3 @@ DEF_BENCH( return new MutexBench<SkSharedMutex>(SkString("SkSharedMutex")); )
|
||||
DEF_BENCH( return new MutexBench<SkMutex>(SkString("SkMutex")); )
|
||||
DEF_BENCH( return new MutexBench<SkSpinlock>(SkString("SkSpinlock")); )
|
||||
DEF_BENCH( return new SharedBench; )
|
||||
|
||||
|
@ -12,11 +12,11 @@
|
||||
#include "SkString.h"
|
||||
|
||||
/**
|
||||
* This bench measures the rendering time of the call SkCanvas::drawPatch with different types of
|
||||
* input patches (regular case, with loops, a square, with a big difference between "parallel"
|
||||
* sides). This bench also tests the different combination of optional parameters for the function
|
||||
* This bench measures the rendering time of the call SkCanvas::drawPatch with different types of
|
||||
* input patches (regular case, with loops, a square, with a big difference between "parallel"
|
||||
* sides). This bench also tests the different combination of optional parameters for the function
|
||||
* (passing texture coordinates and colors, only textures coordinates, only colors or none).
|
||||
* Finally, it applies a scale to test if the size affects the rendering time.
|
||||
* Finally, it applies a scale to test if the size affects the rendering time.
|
||||
*/
|
||||
|
||||
class PatchBench : public Benchmark {
|
||||
|
@ -13,34 +13,34 @@
|
||||
#include "SkString.h"
|
||||
|
||||
/**
|
||||
* This bench measures the rendering time of a gridof patches.
|
||||
* This bench also tests the different combination of optional parameters for the function
|
||||
* This bench measures the rendering time of a gridof patches.
|
||||
* This bench also tests the different combination of optional parameters for the function
|
||||
* (passing texture coordinates and colors, only textures coordinates, only colors or none).
|
||||
* Finally, it also has 3 possible sizes small, medium and big to test if the size of the patches
|
||||
* in the grid affects time.
|
||||
* in the grid affects time.
|
||||
*/
|
||||
|
||||
class PatchGridBench : public Benchmark {
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
enum Size {
|
||||
kSmall_Size,
|
||||
kMedium_Size,
|
||||
kBig_Size
|
||||
};
|
||||
|
||||
|
||||
enum VertexMode {
|
||||
kNone_VertexMode,
|
||||
kColors_VertexMode,
|
||||
kTexCoords_VertexMode,
|
||||
kBoth_VertexMode
|
||||
};
|
||||
|
||||
|
||||
PatchGridBench(Size size, VertexMode vertexMode)
|
||||
: fVertexMode(vertexMode)
|
||||
, fSize(size) { }
|
||||
|
||||
|
||||
void setScale(SkCanvas* canvas){
|
||||
switch (fSize) {
|
||||
case kSmall_Size:
|
||||
@ -54,7 +54,7 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setGrid() {
|
||||
SkPoint vertices[4][5] = {
|
||||
{{50,50}, {150,50}, {250,50},{350,50},{450,50}},
|
||||
@ -62,28 +62,28 @@ public:
|
||||
{{50,250}, {150,250}, {250,250},{350,250},{450,250}},
|
||||
{{100,300}, {150,350}, {250,350},{350,350},{450,350}}
|
||||
};
|
||||
|
||||
|
||||
SkColor cornerColors[4][5] = {
|
||||
{SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE},
|
||||
{SK_ColorRED, SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE, SK_ColorRED},
|
||||
{SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE},
|
||||
{SK_ColorRED, SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE, SK_ColorRED},
|
||||
};
|
||||
|
||||
|
||||
SkPoint texCoords[4][5] = {
|
||||
{{0.0f,0.0f}, {1.0f,0.0f}, {2.0f,0.0f}, {3.0f,0.0f}, {4.0f,0.0f}},
|
||||
{{0.0f,1.0f}, {1.0f,1.0f}, {2.0f,1.0f}, {3.0f,1.0f}, {4.0f,1.0f}},
|
||||
{{0.0f,2.0f}, {1.0f,2.0f}, {2.0f,2.0f}, {3.0f,2.0f}, {4.0f,2.0f}},
|
||||
{{0.0f,3.0f}, {1.0f,3.0f}, {2.0f,3.0f}, {3.0f,3.0f}, {4.0f,3.0f}},
|
||||
};
|
||||
|
||||
|
||||
SkPoint hrzCtrl[4][8] = {
|
||||
{{75,30},{125,45},{175,70},{225,20},{275,50},{325,50},{375,5},{425,90}},
|
||||
{{75,150},{125,150},{175,150},{225,150},{275,150},{325,150},{375,150},{425,150}},
|
||||
{{75,250},{125,250},{175,250},{225,250},{275,200},{325,150},{375,250},{425,250}},
|
||||
{{75,350},{125,350},{175,350},{225,350},{275,350},{325,350},{375,350},{425,350}}
|
||||
};
|
||||
|
||||
|
||||
SkPoint vrtCtrl[6][5] = {
|
||||
{{50,75},{150,75},{250,75},{350,75},{450,75}},
|
||||
{{50,125},{150,125},{250,125},{350,125},{450,125}},
|
||||
@ -92,43 +92,43 @@ public:
|
||||
{{50,275},{150,275},{250,275},{350,275},{400,305}},
|
||||
{{50,325},{150,325},{250,325},{350,325},{450,325}}
|
||||
};
|
||||
|
||||
|
||||
static const int kRows = 3;
|
||||
static const int kCols = 4;
|
||||
|
||||
|
||||
fGrid.reset(kRows, kCols, SkPatchGrid::kColors_VertexType, nullptr);
|
||||
for (int i = 0; i < kRows; i++) {
|
||||
for (int j = 0; j < kCols; j++) {
|
||||
SkPoint points[12];
|
||||
|
||||
|
||||
//set corners
|
||||
points[SkPatchUtils::kTopP0_CubicCtrlPts] = vertices[i][j];
|
||||
points[SkPatchUtils::kTopP3_CubicCtrlPts] = vertices[i][j + 1];
|
||||
points[SkPatchUtils::kBottomP0_CubicCtrlPts] = vertices[i + 1][j];
|
||||
points[SkPatchUtils::kBottomP3_CubicCtrlPts] = vertices[i + 1][j + 1];
|
||||
|
||||
|
||||
points[SkPatchUtils::kTopP1_CubicCtrlPts] = hrzCtrl[i][j * 2];
|
||||
points[SkPatchUtils::kTopP2_CubicCtrlPts] = hrzCtrl[i][j * 2 + 1];
|
||||
points[SkPatchUtils::kBottomP1_CubicCtrlPts] = hrzCtrl[i + 1][j * 2];
|
||||
points[SkPatchUtils::kBottomP2_CubicCtrlPts] = hrzCtrl[i + 1][j * 2 + 1];
|
||||
|
||||
|
||||
points[SkPatchUtils::kLeftP1_CubicCtrlPts] = vrtCtrl[i * 2][j];
|
||||
points[SkPatchUtils::kLeftP2_CubicCtrlPts] = vrtCtrl[i * 2 + 1][j];
|
||||
points[SkPatchUtils::kRightP1_CubicCtrlPts] = vrtCtrl[i * 2][j + 1];
|
||||
points[SkPatchUtils::kRightP2_CubicCtrlPts] = vrtCtrl[i * 2 + 1][j + 1];
|
||||
|
||||
|
||||
SkColor colors[4];
|
||||
colors[0] = cornerColors[i][j];
|
||||
colors[1] = cornerColors[i][j + 1];
|
||||
colors[3] = cornerColors[i + 1][j];
|
||||
colors[2] = cornerColors[i + 1][j + 1];
|
||||
|
||||
|
||||
SkPoint texs[4];
|
||||
texs[0] = texCoords[i][j];
|
||||
texs[1] = texCoords[i][j + 1];
|
||||
texs[3] = texCoords[i + 1][j];
|
||||
texs[2] = texCoords[i + 1][j + 1];
|
||||
|
||||
|
||||
switch (fVertexMode) {
|
||||
case kNone_VertexMode:
|
||||
fGrid.setPatch(j, i, points, nullptr, nullptr);
|
||||
@ -148,7 +148,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// override this method to change the shader
|
||||
sk_sp<SkShader> createShader() {
|
||||
const SkColor colors[] = {
|
||||
@ -156,7 +156,7 @@ public:
|
||||
SK_ColorMAGENTA, SK_ColorBLUE, SK_ColorYELLOW,
|
||||
};
|
||||
const SkPoint pts[] = { { 200.f / 4.f, 0.f }, { 3.f * 200.f / 4, 200.f } };
|
||||
|
||||
|
||||
return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
|
||||
SkShader::kMirror_TileMode);
|
||||
}
|
||||
@ -180,7 +180,7 @@ protected:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
SkString size;
|
||||
switch (fSize) {
|
||||
case kSmall_Size:
|
||||
@ -198,7 +198,7 @@ protected:
|
||||
fName.printf("patch_grid_%s_%s", vertexMode.c_str(), size.c_str());
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
|
||||
void onDelayedSetup() override {
|
||||
this->setGrid();
|
||||
switch (fVertexMode) {
|
||||
@ -225,7 +225,7 @@ protected:
|
||||
SkPatchGrid fGrid;
|
||||
VertexMode fVertexMode;
|
||||
Size fSize;
|
||||
|
||||
|
||||
typedef Benchmark INHERITED;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2012 The Android Open Source Project
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
kSmallPow2_RectType
|
||||
};
|
||||
|
||||
RectanizerBench(RectanizerType rectanizerType, RectType rectType)
|
||||
RectanizerBench(RectanizerType rectanizerType, RectType rectType)
|
||||
: fName("rectanizer_")
|
||||
, fRectanizerType(rectanizerType)
|
||||
, fRectType(rectType) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
/** This benchmark tests rendering rotated rectangles. It can optionally apply AA and/or change the
|
||||
paint color between each rect in different ways using the ColorType enum. The xfermode used can
|
||||
be specified as well.
|
||||
be specified as well.
|
||||
*/
|
||||
|
||||
enum ColorType {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2016 Google Inc.
|
||||
*
|
||||
|
@ -342,5 +342,3 @@ DEF_BENCH(return new SkBitmapFPGeneral(
|
||||
DEF_BENCH(return new SkBitmapFPOrigShader(
|
||||
srcSize, kLinear_SkColorProfileType, mR, true,
|
||||
SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);)
|
||||
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -76,4 +76,3 @@ private:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DEF_BENCH( return new TopoSortBench(); )
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2012 The Android Open Source Project
|
||||
*
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
, fFlags(flags & ~USE_AA)
|
||||
{
|
||||
fXfer.reset(SkXfermode::Create(mode));
|
||||
|
||||
|
||||
fProc1 = SkXfermode::GetD32Proc(fXfer, fFlags | SkXfermode::kSrcIsSingle_D32Flag);
|
||||
fProcN = SkXfermode::GetD32Proc(fXfer, fFlags);
|
||||
fName.printf("xfer4f_%s_%s_%c_%s_%s",
|
||||
@ -37,7 +37,7 @@ public:
|
||||
fDst[i] = 0;
|
||||
fAAStorage[i] = i * 255 / (N - 1);
|
||||
}
|
||||
|
||||
|
||||
if (flags & USE_AA) {
|
||||
fAA = fAAStorage;
|
||||
} else {
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
fDst[i] = 0;
|
||||
fAAStorage[i] = i * 255 / (N - 1);
|
||||
}
|
||||
|
||||
|
||||
if (flags & USE_AA) {
|
||||
fAA = fAAStorage;
|
||||
} else {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -49,5 +49,3 @@ bool HWUITarget::init(SkImageInfo info, Benchmark* bench) {
|
||||
bool HWUITarget::capturePixels(SkBitmap* bmp) {
|
||||
return this->renderer.capturePixels(bmp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,7 +206,7 @@ public:
|
||||
ClipCubicGM() {
|
||||
fVPath.moveTo(W, 0);
|
||||
fVPath.cubicTo(W, H-10, 0, 10, 0, H);
|
||||
|
||||
|
||||
SkMatrix pivot;
|
||||
pivot.setRotate(90, W/2, H/2);
|
||||
fVPath.transform(pivot, &fHPath);
|
||||
@ -216,7 +216,7 @@ protected:
|
||||
SkString onShortName() override {
|
||||
return SkString("clipcubic");
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(400, 410);
|
||||
}
|
||||
@ -224,10 +224,10 @@ protected:
|
||||
void doDraw(SkCanvas* canvas, const SkPath& path) {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
|
||||
paint.setColor(sk_tool_utils::color_to_565(0xFFCCCCCC));
|
||||
canvas->drawPath(path, paint);
|
||||
|
||||
|
||||
paint.setColor(SK_ColorRED);
|
||||
paint.setStyle(SkPaint::kStroke_Style);
|
||||
canvas->drawPath(path, paint);
|
||||
@ -242,7 +242,7 @@ protected:
|
||||
|
||||
canvas->drawRect(r, paint);
|
||||
this->doDraw(canvas, path);
|
||||
|
||||
|
||||
canvas->translate(dx, dy);
|
||||
|
||||
canvas->drawRect(r, paint);
|
||||
@ -256,7 +256,7 @@ protected:
|
||||
canvas->translate(0, 200);
|
||||
this->drawAndClip(canvas, fHPath, 200, 0);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
@ -113,8 +112,8 @@ protected:
|
||||
kLabelSpacing + kShapeTypeSpacing * 1.5f + kShapeSpacing / 2,
|
||||
kSubtitleSpacing / 2 + fLabelPaint.getTextSize() / 3, fLabelPaint);
|
||||
canvas->drawText("Src Opaque", sizeof("Src Opaque") - 1,
|
||||
kLabelSpacing + kShapeTypeSpacing * 1.5f + kShapeSpacing / 2 +
|
||||
kPaintSpacing, kSubtitleSpacing / 2 + fLabelPaint.getTextSize() / 3,
|
||||
kLabelSpacing + kShapeTypeSpacing * 1.5f + kShapeSpacing / 2 +
|
||||
kPaintSpacing, kSubtitleSpacing / 2 + fLabelPaint.getTextSize() / 3,
|
||||
fLabelPaint);
|
||||
}
|
||||
|
||||
|
@ -120,12 +120,12 @@ DEF_GM( return new AddArcMeasGM; )
|
||||
class StrokeCircleGM : public skiagm::GM {
|
||||
public:
|
||||
StrokeCircleGM() : fRotate(0) {}
|
||||
|
||||
|
||||
protected:
|
||||
SkString onShortName() override { return SkString("strokecircle"); }
|
||||
|
||||
|
||||
SkISize onISize() override { return SkISize::Make(520, 520); }
|
||||
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
canvas->scale(20, 20);
|
||||
canvas->translate(13, 13);
|
||||
@ -176,12 +176,12 @@ static void html_canvas_arc(SkPath* path, SkScalar x, SkScalar y, SkScalar r, Sk
|
||||
class ManyArcsGM : public skiagm::GM {
|
||||
public:
|
||||
ManyArcsGM() {}
|
||||
|
||||
|
||||
protected:
|
||||
SkString onShortName() override { return SkString("manyarcs"); }
|
||||
|
||||
|
||||
SkISize onISize() override { return SkISize::Make(620, 330); }
|
||||
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
@ -197,12 +197,12 @@ protected:
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(sweepAngles); ++i) {
|
||||
sweepAngles[i] *= 180;
|
||||
}
|
||||
|
||||
|
||||
SkScalar startAngles[] = { -1, -0.5f, 0, 0.5f };
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles); ++i) {
|
||||
startAngles[i] *= 180;
|
||||
}
|
||||
|
||||
|
||||
bool anticlockwise = false;
|
||||
SkScalar sign = 1;
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(startAngles) * 2; ++i) {
|
||||
@ -225,9 +225,8 @@ protected:
|
||||
canvas->translate(0, 40);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new ManyArcsGM; )
|
||||
|
||||
|
@ -60,7 +60,7 @@ protected:
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkScalar gScales[] = { 0.9f, 0.8f, 0.75f, 0.6f, 0.5f, 0.4f, 0.25f, 0.2f, 0.1f };
|
||||
|
||||
|
||||
SkASSERT(kNumVertImages-1 == (int)SK_ARRAY_COUNT(gScales)/2);
|
||||
|
||||
// Minimize vertically
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -74,7 +74,7 @@ protected:
|
||||
for (size_t et = 0; et < SK_ARRAY_COUNT(kEdgeTypes); ++et) {
|
||||
GrPrimitiveEdgeType edgeType = kEdgeTypes[et];
|
||||
canvas->save();
|
||||
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
|
||||
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
|
||||
|
||||
// Draw a background for the test case
|
||||
SkPaint paint;
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
@ -78,7 +77,7 @@ protected:
|
||||
canvas->clear(sk_tool_utils::color_to_565(0xFFDDDDDD));
|
||||
paint.setAntiAlias(true);
|
||||
sk_tool_utils::set_portable_typeface(&paint);
|
||||
|
||||
|
||||
SkScalar width = SkIntToScalar(40);
|
||||
SkScalar height = SkIntToScalar(40);
|
||||
if (paint.getFontSpacing() > height) {
|
||||
|
@ -131,19 +131,19 @@ class TestExtractAlphaGM : public skiagm::GM {
|
||||
|
||||
fBitmap.extractAlpha(&fAlpha);
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
SkBitmap fBitmap, fAlpha;
|
||||
|
||||
|
||||
protected:
|
||||
SkString onShortName() override {
|
||||
return SkString("extractalpha");
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(540, 330);
|
||||
}
|
||||
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
@ -153,9 +153,8 @@ protected:
|
||||
canvas->drawBitmap(fBitmap, 10, 10, &paint); // should stay blue (ignore paint's color)
|
||||
canvas->drawBitmap(fAlpha, 120, 10, &paint); // should draw red
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new TestExtractAlphaGM; )
|
||||
|
||||
|
@ -281,4 +281,3 @@ DEF_GM( return new DrawBitmapRect3(); )
|
||||
DEF_GM( return new DrawBitmapRect4(false); )
|
||||
DEF_GM( return new DrawBitmapRect4(true); )
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -156,7 +156,7 @@ bool make_ringed_alpha_image(GrContext* ctx, TestPixels* result, int width, int
|
||||
|
||||
/** Similar to make_ringed_bitmap with these modifications:
|
||||
- The backing store is a texture.
|
||||
- The texture is larger than the bitmap dimensions (it is surrounded by non-content
|
||||
- The texture is larger than the bitmap dimensions (it is surrounded by non-content
|
||||
padding on the right/bottom of the contents.)
|
||||
- The right/bottom sides of the rings are omitted so that the rect to draw is adjacent to
|
||||
the texture padding.
|
||||
|
@ -39,7 +39,7 @@ protected:
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
|
||||
static const struct {
|
||||
static const struct {
|
||||
SkFilterQuality fQuality;
|
||||
const char* fName;
|
||||
} kQualities[] = {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2012 Intel Inc.
|
||||
*
|
||||
@ -155,7 +154,7 @@ protected:
|
||||
giantPaint.setAntiAlias(true);
|
||||
giantPaint.setColor(0x80808080);
|
||||
canvas->drawCircle(giantCenter.fX, giantCenter.fY, giantRadius, giantPaint);
|
||||
|
||||
|
||||
SkRandom rand;
|
||||
canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1);
|
||||
int i;
|
||||
|
@ -60,7 +60,7 @@ protected:
|
||||
canvas->drawRect(rect, fillPaint);
|
||||
|
||||
canvas->restore();
|
||||
|
||||
|
||||
fillPaint.setColor(0xFF000000);
|
||||
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
|
@ -53,7 +53,7 @@ static void draw_into_canvas(SkCanvas* canvas) {
|
||||
const SkRect r = SkRect::MakeWH(50, 100);
|
||||
sk_sp<SkShader> (*shaders[])() { make_opaque_color, make_alpha_color };
|
||||
sk_sp<SkColorFilter> (*filters[])() { make_cf_null, make_cf0, make_cf1, make_cf2 };
|
||||
|
||||
|
||||
SkPaint paint;
|
||||
for (auto shProc : shaders) {
|
||||
paint.setShader(shProc());
|
||||
|
@ -35,7 +35,7 @@ protected:
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(WIDTH, HEIGHT);
|
||||
}
|
||||
|
||||
|
||||
void onOnceBeforeDraw() override {
|
||||
fSolidImg = CreateSolidBitmap(64, 64);
|
||||
fTransparentImg = CreateTransparentBitmap(64, 64);
|
||||
@ -145,4 +145,3 @@ private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new ColorMatrixGM; )
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
@ -26,7 +25,7 @@ protected:
|
||||
SkString str;
|
||||
str.printf("complexclip3_%s", fDoSimpleClipFirst ? "simple" : "complex");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
SkISize onISize() { return SkISize::Make(1000, 950); }
|
||||
|
||||
|
@ -204,7 +204,7 @@ protected:
|
||||
canvas->translate(0, r.height() + 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
/** This determines the length and width of the bitmaps used in the ComposeShaders. Values
|
||||
* above 20 may cause an SkASSERT to fail in SkSmallAllocator. However, larger values will
|
||||
|
@ -120,7 +120,7 @@ protected:
|
||||
}
|
||||
canvas->restore();
|
||||
|
||||
this->drawGiantCircle(canvas);
|
||||
this->drawGiantCircle(canvas);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -28,7 +28,7 @@ namespace skiagm {
|
||||
// paths
|
||||
class ConvexLineOnlyPathsGM : public GM {
|
||||
public:
|
||||
ConvexLineOnlyPathsGM() {
|
||||
ConvexLineOnlyPathsGM() {
|
||||
this->setBGColor(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ protected:
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
// the right edge of the last drawn path
|
||||
SkPoint offset = { 0, SkScalarHalf(kMaxPathHeight) };
|
||||
SkPoint offset = { 0, SkScalarHalf(kMaxPathHeight) };
|
||||
|
||||
for (int i = 0; i < kNumPaths; ++i) {
|
||||
this->drawPath(canvas, i, &offset);
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint,
|
||||
SkScalar finalX = SkIntToScalar(600), SkScalar finalY = SkIntToScalar(0),
|
||||
SkScalar phase = SkIntToScalar(0),
|
||||
SkScalar phase = SkIntToScalar(0),
|
||||
SkScalar startX = SkIntToScalar(0), SkScalar startY = SkIntToScalar(0)) {
|
||||
SkPaint p(paint);
|
||||
|
||||
@ -453,8 +453,8 @@ protected:
|
||||
paint.setStrokeWidth(SkIntToScalar(phase+1));
|
||||
paint.setColor(gColors[phase]);
|
||||
sign = (x % 20) ? 1 : -1;
|
||||
drawline(canvas, kOn, kOff, paint,
|
||||
SkIntToScalar(x), -sign * SkIntToScalar(10003),
|
||||
drawline(canvas, kOn, kOff, paint,
|
||||
SkIntToScalar(x), -sign * SkIntToScalar(10003),
|
||||
SkIntToScalar(phase),
|
||||
SkIntToScalar(x), sign * SkIntToScalar(10003));
|
||||
phase = (phase + 1) % kIntervalLength;
|
||||
@ -464,8 +464,8 @@ protected:
|
||||
paint.setStrokeWidth(SkIntToScalar(phase+1));
|
||||
paint.setColor(gColors[phase]);
|
||||
sign = (y % 20) ? 1 : -1;
|
||||
drawline(canvas, kOn, kOff, paint,
|
||||
-sign * SkIntToScalar(10003), SkIntToScalar(y),
|
||||
drawline(canvas, kOn, kOff, paint,
|
||||
-sign * SkIntToScalar(10003), SkIntToScalar(y),
|
||||
SkIntToScalar(phase),
|
||||
sign * SkIntToScalar(10003), SkIntToScalar(y));
|
||||
phase = (phase + 1) % kIntervalLength;
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
@ -46,8 +45,8 @@ protected:
|
||||
sk_sp<SkPicture> pict(recorder.finishRecordingAsPicture());
|
||||
|
||||
// Next we play that picture into another picture of the same size.
|
||||
pict->playback(recorder.beginRecording(pict->cullRect().width(),
|
||||
pict->cullRect().height(),
|
||||
pict->playback(recorder.beginRecording(pict->cullRect().width(),
|
||||
pict->cullRect().height(),
|
||||
nullptr, 0));
|
||||
sk_sp<SkPicture> pict2(recorder.finishRecordingAsPicture());
|
||||
|
||||
|
@ -39,17 +39,17 @@ class DrawAtlasGM : public skiagm::GM {
|
||||
|
||||
public:
|
||||
DrawAtlasGM() {}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
SkString onShortName() override {
|
||||
return SkString("draw-atlas");
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(640, 480);
|
||||
}
|
||||
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
const SkRect target = { 50, 50, 80, 90 };
|
||||
if (nullptr == fAtlas) {
|
||||
@ -61,7 +61,7 @@ protected:
|
||||
SkScalar fDegrees;
|
||||
SkScalar fTx;
|
||||
SkScalar fTy;
|
||||
|
||||
|
||||
void apply(SkRSXform* xform) const {
|
||||
const SkScalar rad = SkDegreesToRadians(fDegrees);
|
||||
xform->fSCos = fScale * SkScalarCos(rad);
|
||||
@ -95,9 +95,8 @@ protected:
|
||||
canvas->translate(0, 100);
|
||||
canvas->drawAtlas(fAtlas.get(), xform, tex, colors, N, SkXfermode::kSrcIn_Mode, nullptr, &paint);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new DrawAtlasGM; )
|
||||
|
||||
|
@ -29,22 +29,22 @@ static sk_sp<SkImage> make_atlas(SkCanvas* caller, int atlasSize) {
|
||||
paint.setXfermode(SkXfermode::Create(SkXfermode::kSrc_Mode));
|
||||
|
||||
paint.setColor(SK_ColorWHITE);
|
||||
SkRect r = SkRect::MakeXYWH(0, 0,
|
||||
SkRect r = SkRect::MakeXYWH(0, 0,
|
||||
SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
|
||||
canvas->drawRect(r, paint);
|
||||
|
||||
paint.setColor(SK_ColorRED);
|
||||
r = SkRect::MakeXYWH(SkIntToScalar(kBlockSize), 0,
|
||||
r = SkRect::MakeXYWH(SkIntToScalar(kBlockSize), 0,
|
||||
SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
|
||||
canvas->drawRect(r, paint);
|
||||
|
||||
paint.setColor(SK_ColorGREEN);
|
||||
r = SkRect::MakeXYWH(0, SkIntToScalar(kBlockSize),
|
||||
r = SkRect::MakeXYWH(0, SkIntToScalar(kBlockSize),
|
||||
SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
|
||||
canvas->drawRect(r, paint);
|
||||
|
||||
paint.setColor(SK_ColorTRANSPARENT);
|
||||
r = SkRect::MakeXYWH(SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize),
|
||||
r = SkRect::MakeXYWH(SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize),
|
||||
SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize));
|
||||
canvas->drawRect(r, paint);
|
||||
|
||||
@ -58,17 +58,17 @@ public:
|
||||
DrawAtlasColorsGM() {
|
||||
this->setBGColor(sk_tool_utils::color_to_565(0xFFCCCCCC));
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
SkString onShortName() override {
|
||||
return SkString("draw-atlas-colors");
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(kNumXferModes * (kAtlasSize + kPad) + kPad,
|
||||
2 * kNumColors * (kAtlasSize + kPad) + kTextPad + kPad);
|
||||
}
|
||||
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
const SkRect target = SkRect::MakeWH(SkIntToScalar(kAtlasSize), SkIntToScalar(kAtlasSize));
|
||||
|
||||
@ -147,7 +147,7 @@ protected:
|
||||
}
|
||||
|
||||
for (int i = 0; i < numModes; ++i) {
|
||||
canvas->save();
|
||||
canvas->save();
|
||||
canvas->translate(SkIntToScalar(i*(target.height()+kPad)),
|
||||
SkIntToScalar(kTextPad+kPad));
|
||||
// w/o a paint
|
||||
@ -157,10 +157,10 @@ protected:
|
||||
// w a paint
|
||||
canvas->drawAtlas(fAtlas.get(), xforms, rects, quadColors, numColors,
|
||||
gModes[i].fMode, nullptr, &paint);
|
||||
canvas->restore();
|
||||
canvas->restore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
static const int kNumXferModes = 29;
|
||||
static const int kNumColors = 4;
|
||||
@ -174,4 +174,3 @@ private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new DrawAtlasColorsGM; )
|
||||
|
||||
|
@ -35,7 +35,7 @@ static SkBitmap make_chessbm(int w, int h) {
|
||||
|
||||
static sk_sp<SkImage> makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, int h) {
|
||||
SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
|
||||
|
||||
|
||||
auto surface(origCanvas->makeSurface(info));
|
||||
if (nullptr == surface) {
|
||||
// picture canvas will return null, so fall-back to raster
|
||||
@ -88,7 +88,7 @@ static sk_sp<SkImage> makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, in
|
||||
#if SK_SUPPORT_GPU
|
||||
if (GrTexture* texture = as_IB(image)->peekTexture()) {
|
||||
GrWrapTextureInBitmap(texture, image->width(), image->height(), image->isOpaque(), &tempBM);
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
image->asLegacyBitmap(&tempBM, SkImage::kRO_LegacyBitmapMode);
|
||||
|
@ -140,4 +140,3 @@ private:
|
||||
|
||||
DEF_GM( return new DrawMiniBitmapRectGM(true); )
|
||||
DEF_GM( return new DrawMiniBitmapRectGM(false); )
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
@ -201,7 +200,7 @@ protected:
|
||||
canvas->translate(0, 40);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
@ -298,14 +298,14 @@ protected:
|
||||
for (int i = 0; i < (int)SK_ARRAY_COUNT(gDrawMthds) + kNumXtraCols; ++i) {
|
||||
canvas->drawLine(SkIntToScalar(i * kTileWidth),
|
||||
0,
|
||||
SkIntToScalar(i * kTileWidth),
|
||||
SkIntToScalar(i * kTileWidth),
|
||||
SkIntToScalar(paints.count() * kTileWidth),
|
||||
blackFill);
|
||||
}
|
||||
|
||||
// A column of saveLayers with PictureImageFilters
|
||||
for (int i = 0; i < pifPaints.count(); ++i) {
|
||||
draw_savelayer_with_paint(SkIPoint::Make(0, i*kTileHeight),
|
||||
draw_savelayer_with_paint(SkIPoint::Make(0, i*kTileHeight),
|
||||
canvas, pifPaints[i]);
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ protected:
|
||||
paint.setTextSkewX(fSkewX);
|
||||
|
||||
const SkColor boundsColors[2] = { SK_ColorRED, SK_ColorBLUE };
|
||||
|
||||
|
||||
SkFontMgr* fm = fFM;
|
||||
int count = SkMin32(fm->countFamilies(), 32);
|
||||
|
||||
|
@ -115,7 +115,7 @@ static void set_face(SkPaint* paint) {
|
||||
static void draw_pair(SkCanvas* canvas, SkPaint* paint, const sk_sp<SkShader>& shader) {
|
||||
const char text[] = "Now is the time for all good";
|
||||
const size_t len = strlen(text);
|
||||
|
||||
|
||||
paint->setShader(nullptr);
|
||||
canvas->drawText(text, len, 10, 20, *paint);
|
||||
paint->setShader(SkShader::MakeColorShader(paint->getColor()));
|
||||
@ -140,7 +140,7 @@ protected:
|
||||
SkString onShortName() override {
|
||||
return SkString("gammagradienttext");
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(300, 300);
|
||||
}
|
||||
@ -164,10 +164,9 @@ protected:
|
||||
canvas->translate(0, 80);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
||||
DEF_GM( return new GammaShaderTextGM; )
|
||||
|
||||
|
@ -107,4 +107,3 @@ SkISize skiagm::SimpleGM::onISize() {
|
||||
SkString skiagm::SimpleGM::onShortName() {
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -510,7 +510,7 @@ protected:
|
||||
paint.setDither(fDither);
|
||||
canvas->drawRect(SkRect::MakeWH(500, 500), paint);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
sk_sp<SkShader> fShader;
|
||||
bool fDither;
|
||||
@ -548,7 +548,7 @@ protected:
|
||||
paint.setShader(fShader);
|
||||
canvas->drawRect(SkRect::MakeWH(500, 500), paint);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
sk_sp<SkShader> fShader;
|
||||
bool fDither;
|
||||
@ -600,7 +600,7 @@ protected:
|
||||
(index + 1) * kHeight), paint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
sk_sp<SkShader> fShader[100];
|
||||
bool fDither;
|
||||
|
@ -291,7 +291,7 @@ protected:
|
||||
canvas->translate(0, 120);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
@ -373,6 +373,3 @@ DEF_GM( return new ImageCacheratorGM("ctable", make_ctable_generator); )
|
||||
#if SK_SUPPORT_GPU
|
||||
DEF_GM( return new ImageCacheratorGM("texture", make_tex_generator); )
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -124,4 +124,3 @@ private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new ImageShaderGM; )
|
||||
|
||||
|
@ -298,7 +298,7 @@ protected:
|
||||
canvas->translate(0, 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
@ -322,4 +322,3 @@ public:
|
||||
}
|
||||
};
|
||||
DEF_GM( return new ImageFiltersText_CF; )
|
||||
|
||||
|
@ -60,8 +60,8 @@ protected:
|
||||
noisePaint.setShader(noise);
|
||||
|
||||
SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10));
|
||||
SkPoint3 spotLocation = SkPoint3::Make(SkIntToScalar(-10),
|
||||
SkIntToScalar(-10),
|
||||
SkPoint3 spotLocation = SkPoint3::Make(SkIntToScalar(-10),
|
||||
SkIntToScalar(-10),
|
||||
SkIntToScalar(20));
|
||||
SkPoint3 spotTarget = SkPoint3::Make(SkIntToScalar(40), SkIntToScalar(40), 0);
|
||||
SkScalar spotExponent = SK_Scalar1;
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
@ -102,7 +101,7 @@ protected:
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
SkASSERT(fYUVBmps[i].width() == SkToInt(fYUVBmps[i].rowBytes()));
|
||||
yuvHandles[i] = gpu->createTestingOnlyBackendTexture(fYUVBmps[i].getPixels(),
|
||||
fYUVBmps[i].width(),
|
||||
fYUVBmps[i].width(),
|
||||
fYUVBmps[i].height(),
|
||||
kAlpha_8_GrPixelConfig);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ protected:
|
||||
int curColor = 0;
|
||||
|
||||
for (int x = 0; x < kImageSize; x += 3) {
|
||||
SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(0),
|
||||
SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(0),
|
||||
SkIntToScalar(3), SkIntToScalar(kImageSize));
|
||||
SkPaint p;
|
||||
p.setColor(gColors[curColor]);
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Tests text rendering with LCD and the various blend modes.
|
||||
*/
|
||||
|
||||
@ -40,7 +40,7 @@ public:
|
||||
const int kPointSize = 25;
|
||||
fTextHeight = SkIntToScalar(kPointSize);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
SkString onShortName() override {
|
||||
return SkString("lcdblendmodes");
|
||||
@ -49,9 +49,9 @@ protected:
|
||||
void onOnceBeforeDraw() override {
|
||||
fCheckerboard = sk_tool_utils::create_checkerboard_shader(SK_ColorBLACK, SK_ColorWHITE, 4);
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() override { return SkISize::Make(kWidth, kHeight); }
|
||||
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkPaint p;
|
||||
p.setAntiAlias(false);
|
||||
@ -142,7 +142,7 @@ protected:
|
||||
y+=fTextHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
SkScalar fTextHeight;
|
||||
sk_sp<SkShader> fCheckerboard;
|
||||
|
@ -23,19 +23,19 @@ public:
|
||||
const int pointSize = 36;
|
||||
textHeight = SkIntToScalar(pointSize);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
SkString onShortName() {
|
||||
SkString name("lcdtext");
|
||||
name.append(sk_tool_utils::major_platform_os_name());
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() { return SkISize::Make(640, 480); }
|
||||
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
|
||||
|
||||
y = textHeight;
|
||||
drawText(canvas, SkString("TEXT: SubpixelTrue LCDRenderTrue"),
|
||||
true, true);
|
||||
@ -46,7 +46,7 @@ protected:
|
||||
drawText(canvas, SkString("TEXT: SubpixelFalse LCDRenderFalse"),
|
||||
false, false);
|
||||
}
|
||||
|
||||
|
||||
void drawText(SkCanvas* canvas, const SkString& string,
|
||||
bool subpixelTextEnabled, bool lcdRenderTextEnabled) {
|
||||
SkPaint paint;
|
||||
@ -56,11 +56,11 @@ protected:
|
||||
paint.setSubpixelText(subpixelTextEnabled);
|
||||
paint.setLCDRenderText(lcdRenderTextEnabled);
|
||||
paint.setTextSize(textHeight);
|
||||
|
||||
|
||||
canvas->drawText(string.c_str(), string.size(), 0, y, paint);
|
||||
y += textHeight;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
SkScalar y, textHeight;
|
||||
@ -85,14 +85,14 @@ class LcdTextSizeGM : public skiagm::GM {
|
||||
|
||||
public:
|
||||
LcdTextSizeGM() {}
|
||||
|
||||
|
||||
protected:
|
||||
SkString onShortName() {
|
||||
return SkString("lcdtextsize");
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() { return SkISize::Make(320, 120); }
|
||||
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
const char* lcd_text = "LCD";
|
||||
const char* gray_text = "GRAY";
|
||||
|
@ -92,7 +92,7 @@ protected:
|
||||
|
||||
SkMatrix matrix;
|
||||
matrix.setRectToRect(bitmapBounds, r, SkMatrix::kFill_ScaleToFit);
|
||||
|
||||
|
||||
const SkMatrix& ctm = canvas->getTotalMatrix();
|
||||
|
||||
// TODO: correctly pull out the pure rotation
|
||||
|
@ -99,4 +99,3 @@ private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new LocalMatrixImageFilterGM; )
|
||||
|
||||
|
@ -47,4 +47,3 @@ DEF_SIMPLE_GM(mipmap, canvas, 400, 200) {
|
||||
}
|
||||
canvas->drawImage(img.get(), 20, 20, nullptr);
|
||||
}
|
||||
|
||||
|
@ -424,7 +424,7 @@ static void tiled(SkCanvas* finalCanvas, SkMultiPictureDraw* mpd,
|
||||
|
||||
SkCanvas* subCanvas = step.fSurf->getCanvas();
|
||||
|
||||
const SkMatrix trans = SkMatrix::MakeTrans(-SkIntToScalar(x*kTileWidth),
|
||||
const SkMatrix trans = SkMatrix::MakeTrans(-SkIntToScalar(x*kTileWidth),
|
||||
-SkIntToScalar(y*kTileHeight));
|
||||
|
||||
create_content(mpd, pfGen, pictures, subCanvas, trans);
|
||||
@ -518,7 +518,7 @@ namespace skiagm {
|
||||
|
||||
SkString onShortName() override {
|
||||
static const char* gContentNames[] = {
|
||||
"noclip", "rectclip", "rrectclip", "pathclip",
|
||||
"noclip", "rectclip", "rrectclip", "pathclip",
|
||||
"invpathclip", "sierpinski", "biglayer"
|
||||
};
|
||||
static const char* gLayoutNames[] = { "simple", "tiled" };
|
||||
|
@ -110,4 +110,3 @@ private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new NinePatchStretchGM; )
|
||||
|
||||
|
@ -34,7 +34,7 @@ protected:
|
||||
void onOnceBeforeDraw() override {
|
||||
fBitmap = SkImage::MakeFromBitmap(
|
||||
sk_tool_utils::create_string_bitmap(80, 80, 0xD000D000, 15, 65, 96, "e"));
|
||||
|
||||
|
||||
fCheckerboard = SkImage::MakeFromBitmap(
|
||||
sk_tool_utils::create_checkerboard_bitmap(80, 80,
|
||||
sk_tool_utils::color_to_565(0xFFA0A0A0),
|
||||
@ -103,14 +103,14 @@ DEF_GM( return new OffsetImageFilterGM; )
|
||||
class SimpleOffsetImageFilterGM : public skiagm::GM {
|
||||
public:
|
||||
SimpleOffsetImageFilterGM() {}
|
||||
|
||||
|
||||
protected:
|
||||
SkString onShortName() override {
|
||||
return SkString("simple-offsetimagefilter");
|
||||
}
|
||||
|
||||
|
||||
SkISize onISize() override { return SkISize::Make(640, 200); }
|
||||
|
||||
|
||||
void doDraw(SkCanvas* canvas, const SkRect& r, SkImageFilter* imgf,
|
||||
const SkRect* clipR = nullptr) {
|
||||
SkPaint p;
|
||||
@ -157,22 +157,22 @@ protected:
|
||||
SkImageFilter::CropRect cr2(r2);
|
||||
|
||||
canvas->translate(40, 40);
|
||||
|
||||
|
||||
canvas->save();
|
||||
this->doDraw(canvas, r, nullptr);
|
||||
|
||||
|
||||
canvas->translate(100, 0);
|
||||
this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20));
|
||||
|
||||
|
||||
canvas->translate(100, 0);
|
||||
this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, &cr0));
|
||||
|
||||
|
||||
canvas->translate(100, 0);
|
||||
this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20), &r);
|
||||
|
||||
|
||||
canvas->translate(100, 0);
|
||||
this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, &cr1));
|
||||
|
||||
|
||||
SkRect clipR = SkRect::MakeXYWH(40, 40, 40, 40);
|
||||
canvas->translate(100, 0);
|
||||
this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, nullptr, nullptr), &clipR);
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
|
15
gm/patch.cpp
15
gm/patch.cpp
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
@ -16,7 +15,7 @@ static sk_sp<SkShader> make_shader() {
|
||||
SK_ColorYELLOW,
|
||||
};
|
||||
const SkPoint pts[] = { { 100.f / 4.f, 0.f }, { 3.f * 100.f / 4.f, 100.f } };
|
||||
|
||||
|
||||
return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
|
||||
SkShader::kMirror_TileMode);
|
||||
}
|
||||
@ -66,7 +65,7 @@ static void draw_control_points(SkCanvas* canvas, const SkPoint cubics[12]) {
|
||||
|
||||
DEF_SIMPLE_GM(patch_primitive, canvas, 800, 800) {
|
||||
SkPaint paint;
|
||||
|
||||
|
||||
// The order of the colors and points is clockwise starting at upper-left corner.
|
||||
const SkPoint cubics[SkPatchUtils::kNumCtrlPts] = {
|
||||
//top points
|
||||
@ -78,22 +77,22 @@ DEF_SIMPLE_GM(patch_primitive, canvas, 800, 800) {
|
||||
//left points
|
||||
{50,250},{150,150}
|
||||
};
|
||||
|
||||
|
||||
const SkColor colors[SkPatchUtils::kNumCorners] = {
|
||||
SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorCYAN
|
||||
};
|
||||
const SkPoint texCoords[SkPatchUtils::kNumCorners] = {
|
||||
{0.0f, 0.0f}, {100.0f, 0.0f}, {100.0f,100.0f}, {0.0f, 100.0f}}
|
||||
;
|
||||
|
||||
|
||||
const SkXfermode::Mode modes[] = {
|
||||
SkXfermode::kSrc_Mode,
|
||||
SkXfermode::kDst_Mode,
|
||||
SkXfermode::kModulate_Mode,
|
||||
};
|
||||
|
||||
|
||||
sk_sp<SkShader> shader(make_shader());
|
||||
|
||||
|
||||
canvas->save();
|
||||
for (int y = 0; y < 3; y++) {
|
||||
SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(modes[y]));
|
||||
@ -121,7 +120,7 @@ DEF_SIMPLE_GM(patch_primitive, canvas, 800, 800) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
draw_control_points(canvas, cubics);
|
||||
canvas->restore();
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
@ -57,7 +56,7 @@ namespace skiagm {
|
||||
* This GM draws a grid of patches, it only uses colors so it could be considered a mesh gradient.
|
||||
*/
|
||||
class SkPatchGridGM : public GM {
|
||||
|
||||
|
||||
public:
|
||||
SkPatchGridGM() {
|
||||
this->setBGColor(0xFFFFFFFF);
|
||||
@ -75,28 +74,28 @@ protected:
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
|
||||
SkPaint paint;
|
||||
|
||||
|
||||
SkPoint vertices[4][5] = {
|
||||
{{50,50}, {150,50}, {250,50},{350,50},{450,50}},
|
||||
{{50,150}, {120,120}, {250,150},{350,150},{450,150}},
|
||||
{{50,250}, {150,250}, {250,250},{350,250},{450,250}},
|
||||
{{100,300}, {150,350}, {250,350},{350,350},{450,350}}
|
||||
};
|
||||
|
||||
|
||||
SkColor cornerColors[4][5] = {
|
||||
{SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE},
|
||||
{SK_ColorRED, SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE, SK_ColorRED},
|
||||
{SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE},
|
||||
{SK_ColorRED, SK_ColorBLUE, SK_ColorRED, SK_ColorBLUE, SK_ColorRED},
|
||||
};
|
||||
|
||||
|
||||
SkPoint hrzCtrl[4][8] = {
|
||||
{{75,30},{125,45},{175,70},{225,20},{275,50},{325,50},{375,5},{425,90}},
|
||||
{{75,150},{125,150},{175,150},{225,150},{275,150},{325,150},{375,150},{425,150}},
|
||||
{{75,250},{125,250},{175,250},{225,250},{275,200},{325,150},{375,250},{425,250}},
|
||||
{{75,350},{125,350},{175,350},{225,350},{275,350},{325,350},{375,350},{425,350}}
|
||||
};
|
||||
|
||||
|
||||
SkPoint vrtCtrl[6][5] = {
|
||||
{{50,75},{150,75},{250,75},{350,75},{450,75}},
|
||||
{{50,125},{150,125},{250,125},{350,125},{450,125}},
|
||||
@ -105,42 +104,42 @@ protected:
|
||||
{{50,275},{150,275},{250,275},{350,275},{400,305}},
|
||||
{{50,325},{150,325},{250,325},{350,325},{450,325}}
|
||||
};
|
||||
|
||||
|
||||
static const int kRows = 3;
|
||||
static const int kCols = 4;
|
||||
|
||||
|
||||
canvas->scale(3, 3);
|
||||
SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, nullptr);
|
||||
for (int i = 0; i < kRows; i++) {
|
||||
for (int j = 0; j < kCols; j++) {
|
||||
SkPoint points[12];
|
||||
|
||||
|
||||
//set corners
|
||||
points[SkPatchUtils::kTopP0_CubicCtrlPts] = vertices[i][j];
|
||||
points[SkPatchUtils::kTopP3_CubicCtrlPts] = vertices[i][j + 1];
|
||||
points[SkPatchUtils::kBottomP0_CubicCtrlPts] = vertices[i + 1][j];
|
||||
points[SkPatchUtils::kBottomP3_CubicCtrlPts] = vertices[i + 1][j + 1];
|
||||
|
||||
|
||||
points[SkPatchUtils::kTopP1_CubicCtrlPts] = hrzCtrl[i][j * 2];
|
||||
points[SkPatchUtils::kTopP2_CubicCtrlPts] = hrzCtrl[i][j * 2 + 1];
|
||||
points[SkPatchUtils::kBottomP1_CubicCtrlPts] = hrzCtrl[i + 1][j * 2];
|
||||
points[SkPatchUtils::kBottomP2_CubicCtrlPts] = hrzCtrl[i + 1][j * 2 + 1];
|
||||
|
||||
|
||||
points[SkPatchUtils::kLeftP1_CubicCtrlPts] = vrtCtrl[i * 2][j];
|
||||
points[SkPatchUtils::kLeftP2_CubicCtrlPts] = vrtCtrl[i * 2 + 1][j];
|
||||
points[SkPatchUtils::kRightP1_CubicCtrlPts] = vrtCtrl[i * 2][j + 1];
|
||||
points[SkPatchUtils::kRightP2_CubicCtrlPts] = vrtCtrl[i * 2 + 1][j + 1];
|
||||
|
||||
|
||||
SkColor colors[4];
|
||||
colors[0] = cornerColors[i][j];
|
||||
colors[1] = cornerColors[i][j + 1];
|
||||
colors[3] = cornerColors[i + 1][j];
|
||||
colors[2] = cornerColors[i + 1][j + 1];
|
||||
|
||||
|
||||
grid.setPatch(j, i, points, colors, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
grid.draw(canvas, paint);
|
||||
SkISize dims = grid.getDimensions();
|
||||
for (int y = 0; y < dims.height(); y++) {
|
||||
|
@ -193,4 +193,3 @@ private:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DEF_GM( return new StrokeZeroGM(); )
|
||||
|
||||
|
@ -127,4 +127,3 @@ private:
|
||||
DEF_GM( return new ContourStartGM(); )
|
||||
|
||||
} // namespace skiagm
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* paint.setTextSize(SkIntToScalar(100));
|
||||
* paint.setTypeface(SkTypeface::CreateFromName("Hiragino Maru Gothic Pro"));
|
||||
* paint.getTextPath("e", 1, 50, 50, &path);
|
||||
*
|
||||
*
|
||||
* The path data is duplicated here to allow the test to
|
||||
* run on all platforms and to remove the bug dependency
|
||||
* should future Macs edit or delete the font.
|
||||
|
@ -23,7 +23,7 @@ static sk_sp<SkPicture> make_picture() {
|
||||
paint.setColor(0x80FF0000);
|
||||
path.moveTo(0, 0); path.lineTo(100, 0); path.lineTo(100, 100);
|
||||
canvas->drawPath(path, paint);
|
||||
|
||||
|
||||
paint.setColor(0x8000FF00);
|
||||
path.reset(); path.moveTo(0, 0); path.lineTo(100, 0); path.lineTo(0, 100);
|
||||
canvas->drawPath(path, paint);
|
||||
@ -63,10 +63,10 @@ protected:
|
||||
SkPaint paint;
|
||||
|
||||
canvas->drawPicture(fPicture);
|
||||
|
||||
|
||||
matrix.setTranslate(110, 0);
|
||||
canvas->drawPicture(fPicture, &matrix, nullptr);
|
||||
|
||||
|
||||
matrix.postTranslate(110, 0);
|
||||
canvas->drawPicture(fPicture, &matrix, &paint);
|
||||
|
||||
|
@ -36,7 +36,7 @@ protected:
|
||||
SkPaint bgPaint;
|
||||
bgPaint.setShader(
|
||||
sk_tool_utils::create_checkerboard_shader(
|
||||
sk_tool_utils::color_to_565(0xFFAAAAAA),
|
||||
sk_tool_utils::color_to_565(0xFFAAAAAA),
|
||||
sk_tool_utils::color_to_565(0xFF777777), 1));
|
||||
canvas->drawPaint(bgPaint);
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
|
@ -213,4 +213,3 @@ DEF_SIMPLE_GM(recordopts, canvas, (kTestRectSize+1)*2, (kTestRectSize+1)*15) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user