Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: gm/tiledscaledbitmap.cpp

Issue 1789633002: more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1
2 /* 1 /*
3 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
4 * 3 *
5 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
7
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "Resources.h" 10 #include "Resources.h"
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkImageDecoder.h" 12 #include "SkImageDecoder.h"
13 #include "SkPaint.h" 13 #include "SkPaint.h"
14 #include "SkShader.h" 14 #include "SkShader.h"
15 #include "SkStream.h" 15 #include "SkStream.h"
16 16
17
18 /*** 17 /***
19 * 18 *
20 * This GM reproduces Skia bug 2904, in which a tiled bitmap shader was failing to draw correctly 19 * This GM reproduces Skia bug 2904, in which a tiled bitmap shader was failing to draw correctly
21 * when fractional image scaling was ignored by the high quality bitmap scaler. 20 * when fractional image scaling was ignored by the high quality bitmap scaler.
22 * 21 *
23 ***/ 22 ***/
24 23
25 namespace skiagm { 24 namespace skiagm {
26 25
27 class TiledScaledBitmapGM : public GM { 26 class TiledScaledBitmapGM : public GM {
(...skipping 29 matching lines...) Expand all
57 void onDraw(SkCanvas* canvas) override { 56 void onDraw(SkCanvas* canvas) override {
58 SkPaint paint; 57 SkPaint paint;
59 58
60 paint.setAntiAlias(true); 59 paint.setAntiAlias(true);
61 paint.setFilterQuality(kHigh_SkFilterQuality); 60 paint.setFilterQuality(kHigh_SkFilterQuality);
62 61
63 SkMatrix mat; 62 SkMatrix mat;
64 mat.setScale(121.f/360.f, 93.f/288.f); 63 mat.setScale(121.f/360.f, 93.f/288.f);
65 mat.postTranslate(-72, -72); 64 mat.postTranslate(-72, -72);
66 65
67 SkShader *shader = SkShader::CreateBitmapShader(fBitmap, SkShader::kRepe at_TileMode, SkShader::kRepeat_TileMode, &mat); 66 paint.setShader(SkShader::MakeBitmapShader(fBitmap, SkShader::kRepeat_Ti leMode,
68 paint.setShader(shader); 67 SkShader::kRepeat_TileMode, & mat));
69
70 SkSafeUnref(shader);
71 canvas->drawRectCoords(8,8,1008, 608, paint); 68 canvas->drawRectCoords(8,8,1008, 608, paint);
72 } 69 }
73 70
74 private: 71 private:
75 SkBitmap fBitmap; 72 SkBitmap fBitmap;
76 73
77 typedef GM INHERITED; 74 typedef GM INHERITED;
78 }; 75 };
79 76
80 ////////////////////////////////////////////////////////////////////////////// 77 //////////////////////////////////////////////////////////////////////////////
81 78
82 DEF_GM(return new TiledScaledBitmapGM;) 79 DEF_GM(return new TiledScaledBitmapGM;)
83 } 80 }
OLDNEW
« gm/pictureshadertile.cpp ('K') | « gm/texturedomaineffect.cpp ('k') | gm/tilemodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698