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

Side by Side Diff: gm/bmpfilterqualityrepeat.cpp

Issue 1776973003: partial switch over to sp usage of shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move into lua container 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/blurroundrect.cpp ('k') | gm/circles.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * 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
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "SkShader.h" 10 #include "SkShader.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 SkPaint paint; 53 SkPaint paint;
54 sk_tool_utils::set_portable_typeface(&paint); 54 sk_tool_utils::set_portable_typeface(&paint);
55 paint.setFilterQuality(kQualities[q].fQuality); 55 paint.setFilterQuality(kQualities[q].fQuality);
56 SkPaint bmpPaint(paint); 56 SkPaint bmpPaint(paint);
57 SkMatrix lm = SkMatrix::I(); 57 SkMatrix lm = SkMatrix::I();
58 lm.setScaleX(2.5); 58 lm.setScaleX(2.5);
59 lm.setTranslateX(423); 59 lm.setTranslateX(423);
60 lm.setTranslateY(330); 60 lm.setTranslateY(330);
61 61
62 static const SkShader::TileMode kTM = SkShader::kRepeat_TileMode; 62 static const SkShader::TileMode kTM = SkShader::kRepeat_TileMode;
63 bmpPaint.setShader(SkShader::CreateBitmapShader(fBmp, kTM, kTM, &lm) )->unref(); 63 bmpPaint.setShader(SkShader::MakeBitmapShader(fBmp, kTM, kTM, &lm));
64 SkRect rect = SkRect::MakeLTRB(20, 60, 220, 210); 64 SkRect rect = SkRect::MakeLTRB(20, 60, 220, 210);
65 canvas->drawRect(rect, bmpPaint); 65 canvas->drawRect(rect, bmpPaint);
66 paint.setAntiAlias(true); 66 paint.setAntiAlias(true);
67 canvas->drawText(kQualities[q].fName, strlen(kQualities[q].fName), 2 0, 40, paint); 67 canvas->drawText(kQualities[q].fName, strlen(kQualities[q].fName), 2 0, 40, paint);
68 canvas->translate(250, 0); 68 canvas->translate(250, 0);
69 } 69 }
70 } 70 }
71 71
72 private: 72 private:
73 SkBitmap fBmp; 73 SkBitmap fBmp;
74 74
75 typedef skiagm::GM INHERITED; 75 typedef skiagm::GM INHERITED;
76 }; 76 };
77 77
78 ////////////////////////////////////////////////////////////////////////////// 78 //////////////////////////////////////////////////////////////////////////////
79 79
80 DEF_GM(return new BmpFilterQualityRepeat;) 80 DEF_GM(return new BmpFilterQualityRepeat;)
OLDNEW
« no previous file with comments | « gm/blurroundrect.cpp ('k') | gm/circles.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698