| 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 "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 public: | 57 public: |
| 58 SkBitmap fBM; | 58 SkBitmap fBM; |
| 59 SkMatrix fMatrix[2]; | 59 SkMatrix fMatrix[2]; |
| 60 SkString fName; | 60 SkString fName; |
| 61 | 61 |
| 62 FilterBitmapGM() | 62 FilterBitmapGM() |
| 63 { | 63 { |
| 64 this->setBGColor(0xFFDDDDDD); | 64 this->setBGColor(0xFFDDDDDD); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void setName(const char name[]) { | |
| 68 fName.set(name); | |
| 69 } | |
| 70 | |
| 71 protected: | 67 protected: |
| 72 virtual SkString onShortName() SK_OVERRIDE { | 68 virtual SkString onShortName() SK_OVERRIDE { |
| 73 return fName; | 69 return fName; |
| 74 } | 70 } |
| 75 | 71 |
| 76 virtual SkISize onISize() SK_OVERRIDE { | 72 virtual SkISize onISize() SK_OVERRIDE { |
| 77 return SkISize::Make(920, 480); | 73 return SkISize::Make(920, 480); |
| 78 } | 74 } |
| 79 | 75 |
| 80 virtual void make_bitmap() = 0; | 76 virtual void make_bitmap() = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 95 | 91 |
| 96 private: | 92 private: |
| 97 typedef skiagm::GM INHERITED; | 93 typedef skiagm::GM INHERITED; |
| 98 }; | 94 }; |
| 99 | 95 |
| 100 class FilterBitmapTextGM: public FilterBitmapGM { | 96 class FilterBitmapTextGM: public FilterBitmapGM { |
| 101 public: | 97 public: |
| 102 FilterBitmapTextGM(float textSize) | 98 FilterBitmapTextGM(float textSize) |
| 103 : fTextSize(textSize) | 99 : fTextSize(textSize) |
| 104 { | 100 { |
| 105 char name[1024]; | 101 fName.printf("filterbitmap_text_%.2fpt", fTextSize); |
| 106 sprintf(name, "filterbitmap_text_%.2fpt", fTextSize); | |
| 107 setName(name); | |
| 108 } | 102 } |
| 109 | 103 |
| 110 protected: | 104 protected: |
| 111 float fTextSize; | 105 float fTextSize; |
| 112 | 106 |
| 113 SkScalar get_scale() SK_OVERRIDE { | 107 SkScalar get_scale() SK_OVERRIDE { |
| 114 return 32.f/fTextSize; | 108 return 32.f/fTextSize; |
| 115 } | 109 } |
| 116 | 110 |
| 117 void make_bitmap() SK_OVERRIDE { | 111 void make_bitmap() SK_OVERRIDE { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 136 } | 130 } |
| 137 private: | 131 private: |
| 138 typedef FilterBitmapGM INHERITED; | 132 typedef FilterBitmapGM INHERITED; |
| 139 }; | 133 }; |
| 140 | 134 |
| 141 class FilterBitmapCheckerboardGM: public FilterBitmapGM { | 135 class FilterBitmapCheckerboardGM: public FilterBitmapGM { |
| 142 public: | 136 public: |
| 143 FilterBitmapCheckerboardGM(int size, int num_checks) | 137 FilterBitmapCheckerboardGM(int size, int num_checks) |
| 144 : fSize(size), fNumChecks(num_checks) | 138 : fSize(size), fNumChecks(num_checks) |
| 145 { | 139 { |
| 146 char name[1024]; | 140 fName.printf("filterbitmap_checkerboard_%d_%d", fSize, fNumChecks); |
| 147 sprintf(name, "filterbitmap_checkerboard_%d_%d", fSize, fNumChecks); | |
| 148 setName(name); | |
| 149 } | 141 } |
| 150 | 142 |
| 151 protected: | 143 protected: |
| 152 int fSize; | 144 int fSize; |
| 153 int fNumChecks; | 145 int fNumChecks; |
| 154 | 146 |
| 155 SkScalar get_scale() SK_OVERRIDE { | 147 SkScalar get_scale() SK_OVERRIDE { |
| 156 return 192.f/fSize; | 148 return 192.f/fSize; |
| 157 } | 149 } |
| 158 | 150 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 175 } | 167 } |
| 176 private: | 168 private: |
| 177 typedef FilterBitmapGM INHERITED; | 169 typedef FilterBitmapGM INHERITED; |
| 178 }; | 170 }; |
| 179 | 171 |
| 180 class FilterBitmapImageGM: public FilterBitmapGM { | 172 class FilterBitmapImageGM: public FilterBitmapGM { |
| 181 public: | 173 public: |
| 182 FilterBitmapImageGM(const char filename[]) | 174 FilterBitmapImageGM(const char filename[]) |
| 183 : fFilename(filename) | 175 : fFilename(filename) |
| 184 { | 176 { |
| 185 char name[1024]; | 177 fName.printf("filterbitmap_image_%s", filename); |
| 186 sprintf(name, "filterbitmap_image_%s", filename); | |
| 187 setName(name); | |
| 188 } | 178 } |
| 189 | 179 |
| 190 protected: | 180 protected: |
| 191 SkString fFilename; | 181 SkString fFilename; |
| 192 int fSize; | 182 int fSize; |
| 193 | 183 |
| 194 SkScalar get_scale() SK_OVERRIDE { | 184 SkScalar get_scale() SK_OVERRIDE { |
| 195 return 192.f/fSize; | 185 return 192.f/fSize; |
| 196 } | 186 } |
| 197 | 187 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 DEF_GM( return new FilterBitmapCheckerboardGM(32,32); ) | 220 DEF_GM( return new FilterBitmapCheckerboardGM(32,32); ) |
| 231 DEF_GM( return new FilterBitmapCheckerboardGM(32,8); ) | 221 DEF_GM( return new FilterBitmapCheckerboardGM(32,8); ) |
| 232 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) | 222 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) |
| 233 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) | 223 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) |
| 234 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) | 224 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) |
| 235 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) | 225 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) |
| 236 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) | 226 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) |
| 237 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) | 227 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) |
| 238 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) | 228 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) |
| 239 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) | 229 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) |
| OLD | NEW |