2 * Copyright 2012 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
9 #include "sk_tool_utils.h"
11 #include "SkColorPriv.h"
15 DEF_SIMPLE_GM_BG(bigmatrix, canvas, 50, 50,
16 sk_tool_utils::color_to_565(0xFF66AA99)) {
19 m.setRotate(33 * SK_Scalar1);
20 m.postScale(3000 * SK_Scalar1, 3000 * SK_Scalar1);
21 m.postTranslate(6000 * SK_Scalar1, -5000 * SK_Scalar1);
25 paint.setColor(SK_ColorRED);
26 paint.setAntiAlias(true);
28 bool success = m.invert(&m);
30 (void) success; // silence compiler :(
34 SkPoint pt = {10 * SK_Scalar1, 10 * SK_Scalar1};
35 SkScalar small = 1 / (500 * SK_Scalar1);
38 path.addCircle(pt.fX, pt.fY, small);
39 canvas->drawPath(path, paint);
41 pt.set(30 * SK_Scalar1, 10 * SK_Scalar1);
43 SkRect rect = {pt.fX - small, pt.fY - small,
44 pt.fX + small, pt.fY + small};
45 canvas->drawRect(rect, paint);
48 bmp.allocN32Pixels(2, 2);
49 uint32_t* pixels = reinterpret_cast<uint32_t*>(bmp.getPixels());
50 pixels[0] = SkPackARGB32(0xFF, 0xFF, 0x00, 0x00);
51 pixels[1] = SkPackARGB32(0xFF, 0x00, 0xFF, 0x00);
52 pixels[2] = SkPackARGB32(0x80, 0x00, 0x00, 0x00);
53 pixels[3] = SkPackARGB32(0xFF, 0x00, 0x00, 0xFF);
54 pt.set(30 * SK_Scalar1, 30 * SK_Scalar1);
58 s.setScale(SK_Scalar1 / 1000, SK_Scalar1 / 1000);
59 paint.setShader(SkShader::MakeBitmapShader(bmp, SkShader::kRepeat_TileMode,
60 SkShader::kRepeat_TileMode, &s));
61 paint.setAntiAlias(false);
62 paint.setFilterQuality(kLow_SkFilterQuality);
63 rect.setLTRB(pt.fX - small, pt.fY - small,
64 pt.fX + small, pt.fY + small);
65 canvas->drawRect(rect, paint);