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

Side by Side Diff: gm/tiledscaledbitmap.cpp

Issue 815883002: Cleanup: Another round of override fixes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: revert include changes Created 6 years 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/texdata.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 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * 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
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 13 matching lines...) Expand all
24 24
25 namespace skiagm { 25 namespace skiagm {
26 26
27 class TiledScaledBitmapGM : public GM { 27 class TiledScaledBitmapGM : public GM {
28 public: 28 public:
29 29
30 TiledScaledBitmapGM() { 30 TiledScaledBitmapGM() {
31 } 31 }
32 32
33 protected: 33 protected:
34 virtual SkString onShortName() { 34 virtual SkString onShortName() SK_OVERRIDE {
35 return SkString("tiledscaledbitmap"); 35 return SkString("tiledscaledbitmap");
36 } 36 }
37 37
38 virtual SkISize onISize() { 38 virtual SkISize onISize() SK_OVERRIDE {
39 return SkISize::Make(1016, 616); 39 return SkISize::Make(1016, 616);
40 } 40 }
41 41
42 virtual uint32_t onGetFlags() const SK_OVERRIDE { 42 virtual uint32_t onGetFlags() const SK_OVERRIDE {
43 return kSkipTiled_Flag; 43 return kSkipTiled_Flag;
44 } 44 }
45 45
46 static SkBitmap make_bm(int width, int height) { 46 static SkBitmap make_bm(int width, int height) {
47 SkBitmap bm; 47 SkBitmap bm;
48 bm.allocN32Pixels(width, height); 48 bm.allocN32Pixels(width, height);
49 bm.eraseColor(SK_ColorTRANSPARENT); 49 bm.eraseColor(SK_ColorTRANSPARENT);
50 SkCanvas canvas(bm); 50 SkCanvas canvas(bm);
51 SkPaint paint; 51 SkPaint paint;
52 paint.setAntiAlias(true); 52 paint.setAntiAlias(true);
53 canvas.drawCircle(width/2.f, height/2.f, width/4.f, paint); 53 canvas.drawCircle(width/2.f, height/2.f, width/4.f, paint);
54 return bm; 54 return bm;
55 } 55 }
56 56
57 virtual void onOnceBeforeDraw() SK_OVERRIDE { 57 virtual void onOnceBeforeDraw() SK_OVERRIDE {
58 fBitmap = make_bm(360, 288); 58 fBitmap = make_bm(360, 288);
59 } 59 }
60 60
61 virtual void onDraw(SkCanvas* canvas) { 61 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
62 SkPaint paint; 62 SkPaint paint;
63 63
64 paint.setAntiAlias(true); 64 paint.setAntiAlias(true);
65 paint.setFilterLevel(SkPaint::kHigh_FilterLevel); 65 paint.setFilterLevel(SkPaint::kHigh_FilterLevel);
66 66
67 SkMatrix mat; 67 SkMatrix mat;
68 mat.setScale(121.f/360.f, 93.f/288.f); 68 mat.setScale(121.f/360.f, 93.f/288.f);
69 mat.postTranslate(-72, -72); 69 mat.postTranslate(-72, -72);
70 70
71 SkShader *shader = SkShader::CreateBitmapShader(fBitmap, SkShader::kRepe at_TileMode, SkShader::kRepeat_TileMode, &mat); 71 SkShader *shader = SkShader::CreateBitmapShader(fBitmap, SkShader::kRepe at_TileMode, SkShader::kRepeat_TileMode, &mat);
72 paint.setShader(shader); 72 paint.setShader(shader);
73 73
74 SkSafeUnref(shader); 74 SkSafeUnref(shader);
75 canvas->drawRectCoords(8,8,1008, 608, paint); 75 canvas->drawRectCoords(8,8,1008, 608, paint);
76 } 76 }
77 77
78 private: 78 private:
79 SkBitmap fBitmap; 79 SkBitmap fBitmap;
80 80
81 typedef GM INHERITED; 81 typedef GM INHERITED;
82 }; 82 };
83 83
84 ////////////////////////////////////////////////////////////////////////////// 84 //////////////////////////////////////////////////////////////////////////////
85 85
86 DEF_GM(return SkNEW(TiledScaledBitmapGM);) 86 DEF_GM(return SkNEW(TiledScaledBitmapGM);)
87 87
88 } 88 }
OLDNEW
« no previous file with comments | « gm/texdata.cpp ('k') | gm/tilemodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698