| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkShader.h" | 11 #include "SkShader.h" |
| 12 | 12 |
| 13 /* | 13 /* |
| 14 * Want to ensure that our bitmap sampler (in bitmap shader) keeps plenty of | 14 * Want to ensure that our bitmap sampler (in bitmap shader) keeps plenty of |
| 15 * precision when scaling very large images (where the dx might get very small. | 15 * precision when scaling very large images (where the dx might get very small. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #define W 257 | 18 #define W 257 |
| 19 #define H 161 | 19 #define H 161 |
| 20 | 20 |
| 21 class GiantBitmapGM : public skiagm::GM { | 21 class GiantBitmapGM : public skiagm::GM { |
| 22 SkBitmap* fBM; | 22 SkBitmap* fBM; |
| 23 SkShader::TileMode fMode; | 23 SkShader::TileMode fMode; |
| 24 bool fDoFilter; | 24 bool fDoFilter; |
| 25 bool fDoRotate; | 25 bool fDoRotate; |
| 26 | 26 |
| 27 const SkBitmap& getBitmap() { | 27 const SkBitmap& getBitmap() { |
| 28 if (NULL == fBM) { | 28 if (nullptr == fBM) { |
| 29 fBM = new SkBitmap; | 29 fBM = new SkBitmap; |
| 30 fBM->allocN32Pixels(W, H); | 30 fBM->allocN32Pixels(W, H); |
| 31 fBM->eraseColor(SK_ColorWHITE); | 31 fBM->eraseColor(SK_ColorWHITE); |
| 32 | 32 |
| 33 const SkColor colors[] = { | 33 const SkColor colors[] = { |
| 34 SK_ColorBLUE, SK_ColorRED, SK_ColorBLACK, SK_ColorGREEN | 34 SK_ColorBLUE, SK_ColorRED, SK_ColorBLACK, SK_ColorGREEN |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 SkCanvas canvas(*fBM); | 37 SkCanvas canvas(*fBM); |
| 38 SkPaint paint; | 38 SkPaint paint; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 53 SkScalar xx = SkIntToScalar(x); | 53 SkScalar xx = SkIntToScalar(x); |
| 54 canvas.drawLine(xx, 0, xx, SkIntToScalar(H), | 54 canvas.drawLine(xx, 0, xx, SkIntToScalar(H), |
| 55 paint); | 55 paint); |
| 56 } | 56 } |
| 57 #endif | 57 #endif |
| 58 } | 58 } |
| 59 return *fBM; | 59 return *fBM; |
| 60 } | 60 } |
| 61 | 61 |
| 62 public: | 62 public: |
| 63 GiantBitmapGM(SkShader::TileMode mode, bool doFilter, bool doRotate) : fBM(N
ULL) { | 63 GiantBitmapGM(SkShader::TileMode mode, bool doFilter, bool doRotate) : fBM(n
ullptr) { |
| 64 fMode = mode; | 64 fMode = mode; |
| 65 fDoFilter = doFilter; | 65 fDoFilter = doFilter; |
| 66 fDoRotate = doRotate; | 66 fDoRotate = doRotate; |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual ~GiantBitmapGM() { delete fBM; } | 69 virtual ~GiantBitmapGM() { delete fBM; } |
| 70 | 70 |
| 71 protected: | 71 protected: |
| 72 | 72 |
| 73 SkString onShortName() override { | 73 SkString onShortName() override { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 static skiagm::GMRegistry reg010(G010); | 142 static skiagm::GMRegistry reg010(G010); |
| 143 static skiagm::GMRegistry reg110(G110); | 143 static skiagm::GMRegistry reg110(G110); |
| 144 static skiagm::GMRegistry reg210(G210); | 144 static skiagm::GMRegistry reg210(G210); |
| 145 | 145 |
| 146 static skiagm::GMRegistry reg001(G001); | 146 static skiagm::GMRegistry reg001(G001); |
| 147 static skiagm::GMRegistry reg101(G101); | 147 static skiagm::GMRegistry reg101(G101); |
| 148 static skiagm::GMRegistry reg201(G201); | 148 static skiagm::GMRegistry reg201(G201); |
| 149 static skiagm::GMRegistry reg011(G011); | 149 static skiagm::GMRegistry reg011(G011); |
| 150 static skiagm::GMRegistry reg111(G111); | 150 static skiagm::GMRegistry reg111(G111); |
| 151 static skiagm::GMRegistry reg211(G211); | 151 static skiagm::GMRegistry reg211(G211); |
| OLD | NEW |