2 * Copyright 2013 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
12 static void make_bm(SkBitmap* bm) {
13 bm->allocN32Pixels(60, 60);
23 canvas.drawPath(path, paint);
25 paint.setStyle(SkPaint::kStroke_Style);
26 canvas.drawRect(SkRect::MakeLTRB(0.5f, 0.5f, 59.5f, 59.5f), paint);
29 // This creates a close, but imperfect concatenation of
30 // scaling the image up by its dst-rect
31 // scaling the image down by the matrix' scale
32 // The bug was that for cases like this, we were incorrectly trying to take a
33 // fast-path in the bitmapshader, but ended up drawing the last col of pixels
34 // twice. The fix resulted in (a) not taking the fast-path, but (b) drawing
35 // the image correctly.
37 DEF_SIMPLE_GM(bitmaprecttest, canvas, 320, 240) {
41 canvas->drawBitmap(bm, 150, 45, nullptr);
43 SkScalar scale = 0.472560018f;
45 canvas->scale(scale, scale);
46 canvas->drawBitmapRect(bm, SkRect::MakeXYWH(100, 100, 128, 128), nullptr);
50 canvas->drawBitmap(bm, -310, 45, nullptr);