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

Side by Side Diff: gm/tiledscaledbitmap.cpp

Issue 1790353002: Revert of 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
« no previous file with comments | « gm/texturedomaineffect.cpp ('k') | gm/tilemodes.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
1 /* 2 /*
2 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
3 * 4 *
4 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 6 * found in the LICENSE file.
6 */ 7 */
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
17 /*** 18 /***
18 * 19 *
19 * This GM reproduces Skia bug 2904, in which a tiled bitmap shader was failing to draw correctly 20 * This GM reproduces Skia bug 2904, in which a tiled bitmap shader was failing to draw correctly
20 * when fractional image scaling was ignored by the high quality bitmap scaler. 21 * when fractional image scaling was ignored by the high quality bitmap scaler.
21 * 22 *
22 ***/ 23 ***/
23 24
24 namespace skiagm { 25 namespace skiagm {
25 26
26 class TiledScaledBitmapGM : public GM { 27 class TiledScaledBitmapGM : public GM {
(...skipping 29 matching lines...) Expand all
56 void onDraw(SkCanvas* canvas) override { 57 void onDraw(SkCanvas* canvas) override {
57 SkPaint paint; 58 SkPaint paint;
58 59
59 paint.setAntiAlias(true); 60 paint.setAntiAlias(true);
60 paint.setFilterQuality(kHigh_SkFilterQuality); 61 paint.setFilterQuality(kHigh_SkFilterQuality);
61 62
62 SkMatrix mat; 63 SkMatrix mat;
63 mat.setScale(121.f/360.f, 93.f/288.f); 64 mat.setScale(121.f/360.f, 93.f/288.f);
64 mat.postTranslate(-72, -72); 65 mat.postTranslate(-72, -72);
65 66
66 paint.setShader(SkShader::MakeBitmapShader(fBitmap, SkShader::kRepeat_Ti leMode, 67 SkShader *shader = SkShader::CreateBitmapShader(fBitmap, SkShader::kRepe at_TileMode, SkShader::kRepeat_TileMode, &mat);
67 SkShader::kRepeat_TileMode, & mat)); 68 paint.setShader(shader);
69
70 SkSafeUnref(shader);
68 canvas->drawRectCoords(8,8,1008, 608, paint); 71 canvas->drawRectCoords(8,8,1008, 608, paint);
69 } 72 }
70 73
71 private: 74 private:
72 SkBitmap fBitmap; 75 SkBitmap fBitmap;
73 76
74 typedef GM INHERITED; 77 typedef GM INHERITED;
75 }; 78 };
76 79
77 ////////////////////////////////////////////////////////////////////////////// 80 //////////////////////////////////////////////////////////////////////////////
78 81
79 DEF_GM(return new TiledScaledBitmapGM;) 82 DEF_GM(return new TiledScaledBitmapGM;)
80 } 83 }
OLDNEW
« no previous file with comments | « gm/texturedomaineffect.cpp ('k') | gm/tilemodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698