| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 SkString onShortName() SK_OVERRIDE { | 38 SkString onShortName() SK_OVERRIDE { |
| 39 SkString str; | 39 SkString str; |
| 40 str.printf("bitmaprect_%s", fUseIRect ? "i" : "s"); | 40 str.printf("bitmaprect_%s", fUseIRect ? "i" : "s"); |
| 41 return str; | 41 return str; |
| 42 } | 42 } |
| 43 | 43 |
| 44 SkISize onISize() SK_OVERRIDE { | 44 SkISize onISize() SK_OVERRIDE { |
| 45 return SkISize::Make(640, 480); | 45 return SkISize::Make(640, 480); |
| 46 } | 46 } |
| 47 | 47 |
| 48 #ifdef SK_CPU_ARM64 | |
| 49 // Skip tiled drawing on 64-bit ARM until https://skbug.com/2908 is fixed. | |
| 50 uint32_t onGetFlags() const SK_OVERRIDE { | |
| 51 return kSkipTiled_Flag; | |
| 52 } | |
| 53 #endif | |
| 54 | |
| 55 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 48 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 56 canvas->drawColor(0xFFCCCCCC); | 49 canvas->drawColor(0xFFCCCCCC); |
| 57 | 50 |
| 58 const SkIRect src[] = { | 51 const SkIRect src[] = { |
| 59 { 0, 0, 32, 32 }, | 52 { 0, 0, 32, 32 }, |
| 60 { 0, 0, 80, 80 }, | 53 { 0, 0, 80, 80 }, |
| 61 { 32, 32, 96, 96 }, | 54 { 32, 32, 96, 96 }, |
| 62 { -32, -32, 32, 32, } | 55 { -32, -32, 32, 32, } |
| 63 }; | 56 }; |
| 64 | 57 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 SkPaint paint; | 257 SkPaint paint; |
| 265 paint.setColor(SK_ColorRED); | 258 paint.setColor(SK_ColorRED); |
| 266 | 259 |
| 267 const SkRect r = SkRect::MakeXYWH(1, 1, 110, 114); | 260 const SkRect r = SkRect::MakeXYWH(1, 1, 110, 114); |
| 268 canvas->scale(0.9f, 0.9f); | 261 canvas->scale(0.9f, 0.9f); |
| 269 | 262 |
| 270 // the drawRect shows the same problem as clipRect(r) followed by drawco
lor(red) | 263 // the drawRect shows the same problem as clipRect(r) followed by drawco
lor(red) |
| 271 canvas->drawRect(r, paint); | 264 canvas->drawRect(r, paint); |
| 272 canvas->drawBitmapRect(fBM, NULL, r, NULL); | 265 canvas->drawBitmapRect(fBM, NULL, r, NULL); |
| 273 } | 266 } |
| 274 | 267 |
| 275 private: | 268 private: |
| 276 typedef skiagm::GM INHERITED; | 269 typedef skiagm::GM INHERITED; |
| 277 }; | 270 }; |
| 278 DEF_GM( return new BitmapRectRounding; ) | 271 DEF_GM( return new BitmapRectRounding; ) |
| 279 | 272 |
| 280 ////////////////////////////////////////////////////////////////////////////// | 273 ////////////////////////////////////////////////////////////////////////////// |
| 281 | 274 |
| 282 static skiagm::GM* MyFactory0(void*) { return new DrawBitmapRect2(false); } | 275 static skiagm::GM* MyFactory0(void*) { return new DrawBitmapRect2(false); } |
| 283 static skiagm::GM* MyFactory1(void*) { return new DrawBitmapRect2(true); } | 276 static skiagm::GM* MyFactory1(void*) { return new DrawBitmapRect2(true); } |
| 284 | 277 |
| 285 static skiagm::GM* MyFactory2(void*) { return new DrawBitmapRect3(); } | 278 static skiagm::GM* MyFactory2(void*) { return new DrawBitmapRect3(); } |
| 286 | 279 |
| 287 #ifndef SK_BUILD_FOR_ANDROID | 280 #ifndef SK_BUILD_FOR_ANDROID |
| 288 static skiagm::GM* MyFactory3(void*) { return new DrawBitmapRect4(false); } | 281 static skiagm::GM* MyFactory3(void*) { return new DrawBitmapRect4(false); } |
| 289 static skiagm::GM* MyFactory4(void*) { return new DrawBitmapRect4(true); } | 282 static skiagm::GM* MyFactory4(void*) { return new DrawBitmapRect4(true); } |
| 290 #endif | 283 #endif |
| 291 | 284 |
| 292 static skiagm::GMRegistry reg0(MyFactory0); | 285 static skiagm::GMRegistry reg0(MyFactory0); |
| 293 static skiagm::GMRegistry reg1(MyFactory1); | 286 static skiagm::GMRegistry reg1(MyFactory1); |
| 294 | 287 |
| 295 static skiagm::GMRegistry reg2(MyFactory2); | 288 static skiagm::GMRegistry reg2(MyFactory2); |
| 296 | 289 |
| 297 #ifndef SK_BUILD_FOR_ANDROID | 290 #ifndef SK_BUILD_FOR_ANDROID |
| 298 static skiagm::GMRegistry reg3(MyFactory3); | 291 static skiagm::GMRegistry reg3(MyFactory3); |
| 299 static skiagm::GMRegistry reg4(MyFactory4); | 292 static skiagm::GMRegistry reg4(MyFactory4); |
| 300 #endif | 293 #endif |
| 301 | 294 |
| OLD | NEW |