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

Side by Side Diff: gm/drawatlas.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/distantclip.cpp ('k') | gm/drawatlascolor.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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkRSXform.h" 10 #include "SkRSXform.h"
(...skipping 21 matching lines...) Expand all
32 paint.setColor(SK_ColorBLUE); 32 paint.setColor(SK_ColorBLUE);
33 paint.setAntiAlias(true); 33 paint.setAntiAlias(true);
34 canvas->drawOval(target, paint); 34 canvas->drawOval(target, paint);
35 return surface->makeImageSnapshot(); 35 return surface->makeImageSnapshot();
36 } 36 }
37 37
38 sk_sp<SkImage> fAtlas; 38 sk_sp<SkImage> fAtlas;
39 39
40 public: 40 public:
41 DrawAtlasGM() {} 41 DrawAtlasGM() {}
42 42
43 protected: 43 protected:
44 44
45 SkString onShortName() override { 45 SkString onShortName() override {
46 return SkString("draw-atlas"); 46 return SkString("draw-atlas");
47 } 47 }
48 48
49 SkISize onISize() override { 49 SkISize onISize() override {
50 return SkISize::Make(640, 480); 50 return SkISize::Make(640, 480);
51 } 51 }
52 52
53 void onDraw(SkCanvas* canvas) override { 53 void onDraw(SkCanvas* canvas) override {
54 const SkRect target = { 50, 50, 80, 90 }; 54 const SkRect target = { 50, 50, 80, 90 };
55 if (nullptr == fAtlas) { 55 if (nullptr == fAtlas) {
56 fAtlas = MakeAtlas(canvas, target); 56 fAtlas = MakeAtlas(canvas, target);
57 } 57 }
58 58
59 const struct { 59 const struct {
60 SkScalar fScale; 60 SkScalar fScale;
61 SkScalar fDegrees; 61 SkScalar fDegrees;
62 SkScalar fTx; 62 SkScalar fTx;
63 SkScalar fTy; 63 SkScalar fTy;
64 64
65 void apply(SkRSXform* xform) const { 65 void apply(SkRSXform* xform) const {
66 const SkScalar rad = SkDegreesToRadians(fDegrees); 66 const SkScalar rad = SkDegreesToRadians(fDegrees);
67 xform->fSCos = fScale * SkScalarCos(rad); 67 xform->fSCos = fScale * SkScalarCos(rad);
68 xform->fSSin = fScale * SkScalarSin(rad); 68 xform->fSSin = fScale * SkScalarSin(rad);
69 xform->fTx = fTx; 69 xform->fTx = fTx;
70 xform->fTy = fTy; 70 xform->fTy = fTy;
71 } 71 }
72 } rec[] = { 72 } rec[] = {
73 { 1, 0, 10, 10 }, // just translate 73 { 1, 0, 10, 10 }, // just translate
74 { 2, 0, 110, 10 }, // scale + translate 74 { 2, 0, 110, 10 }, // scale + translate
(...skipping 13 matching lines...) Expand all
88 } 88 }
89 89
90 SkPaint paint; 90 SkPaint paint;
91 paint.setFilterQuality(kLow_SkFilterQuality); 91 paint.setFilterQuality(kLow_SkFilterQuality);
92 paint.setAntiAlias(true); 92 paint.setAntiAlias(true);
93 93
94 canvas->drawAtlas(fAtlas.get(), xform, tex, N, nullptr, &paint); 94 canvas->drawAtlas(fAtlas.get(), xform, tex, N, nullptr, &paint);
95 canvas->translate(0, 100); 95 canvas->translate(0, 100);
96 canvas->drawAtlas(fAtlas.get(), xform, tex, colors, N, SkXfermode::kSrcI n_Mode, nullptr, &paint); 96 canvas->drawAtlas(fAtlas.get(), xform, tex, colors, N, SkXfermode::kSrcI n_Mode, nullptr, &paint);
97 } 97 }
98 98
99 private: 99 private:
100 typedef GM INHERITED; 100 typedef GM INHERITED;
101 }; 101 };
102 DEF_GM( return new DrawAtlasGM; ) 102 DEF_GM( return new DrawAtlasGM; )
103
OLDNEW
« no previous file with comments | « gm/distantclip.cpp ('k') | gm/drawatlascolor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698