| 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 17 matching lines...) Expand all Loading... |
| 28 canvas.drawCircle(32, 32, 32, paint); | 28 canvas.drawCircle(32, 32, 32, paint); |
| 29 } | 29 } |
| 30 | 30 |
| 31 class DrawBitmapRect2 : public skiagm::GM { | 31 class DrawBitmapRect2 : public skiagm::GM { |
| 32 bool fUseIRect; | 32 bool fUseIRect; |
| 33 public: | 33 public: |
| 34 DrawBitmapRect2(bool useIRect) : fUseIRect(useIRect) { | 34 DrawBitmapRect2(bool useIRect) : fUseIRect(useIRect) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 virtual 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 virtual 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 | 48 #ifdef SK_CPU_ARM64 |
| 49 // Skip tiled drawing on 64-bit ARM until https://skbug.com/2908 is fixed. | 49 // Skip tiled drawing on 64-bit ARM until https://skbug.com/2908 is fixed. |
| 50 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 50 uint32_t onGetFlags() const SK_OVERRIDE { |
| 51 return kSkipTiled_Flag; | 51 return kSkipTiled_Flag; |
| 52 } | 52 } |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 55 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 56 canvas->drawColor(0xFFCCCCCC); | 56 canvas->drawColor(0xFFCCCCCC); |
| 57 | 57 |
| 58 const SkIRect src[] = { | 58 const SkIRect src[] = { |
| 59 { 0, 0, 32, 32 }, | 59 { 0, 0, 32, 32 }, |
| 60 { 0, 0, 80, 80 }, | 60 { 0, 0, 80, 80 }, |
| 61 { 32, 32, 96, 96 }, | 61 { 32, 32, 96, 96 }, |
| 62 { -32, -32, 32, 32, } | 62 { -32, -32, 32, 32, } |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 SkPaint paint; | 65 SkPaint paint; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // | | | 121 // | | |
| 122 // __|____|__ | 122 // __|____|__ |
| 123 // | | | 123 // | | |
| 124 class DrawBitmapRect3 : public skiagm::GM { | 124 class DrawBitmapRect3 : public skiagm::GM { |
| 125 public: | 125 public: |
| 126 DrawBitmapRect3() { | 126 DrawBitmapRect3() { |
| 127 this->setBGColor(SK_ColorBLACK); | 127 this->setBGColor(SK_ColorBLACK); |
| 128 } | 128 } |
| 129 | 129 |
| 130 protected: | 130 protected: |
| 131 virtual SkString onShortName() SK_OVERRIDE { | 131 SkString onShortName() SK_OVERRIDE { |
| 132 SkString str; | 132 SkString str; |
| 133 str.printf("3x3bitmaprect"); | 133 str.printf("3x3bitmaprect"); |
| 134 return str; | 134 return str; |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual SkISize onISize() SK_OVERRIDE { | 137 SkISize onISize() SK_OVERRIDE { |
| 138 return SkISize::Make(640, 480); | 138 return SkISize::Make(640, 480); |
| 139 } | 139 } |
| 140 | 140 |
| 141 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 141 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 142 | 142 |
| 143 SkBitmap bitmap; | 143 SkBitmap bitmap; |
| 144 make_3x3_bitmap(&bitmap); | 144 make_3x3_bitmap(&bitmap); |
| 145 | 145 |
| 146 SkRect srcR = { 0.5f, 0.5f, 2.5f, 2.5f }; | 146 SkRect srcR = { 0.5f, 0.5f, 2.5f, 2.5f }; |
| 147 SkRect dstR = { 100, 100, 300, 200 }; | 147 SkRect dstR = { 100, 100, 300, 200 }; |
| 148 | 148 |
| 149 canvas->drawBitmapRectToRect(bitmap, &srcR, dstR, NULL); | 149 canvas->drawBitmapRectToRect(bitmap, &srcR, dstR, NULL); |
| 150 } | 150 } |
| 151 | 151 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 180 class DrawBitmapRect4 : public skiagm::GM { | 180 class DrawBitmapRect4 : public skiagm::GM { |
| 181 bool fUseIRect; | 181 bool fUseIRect; |
| 182 SkBitmap fBigBitmap; | 182 SkBitmap fBigBitmap; |
| 183 | 183 |
| 184 public: | 184 public: |
| 185 DrawBitmapRect4(bool useIRect) : fUseIRect(useIRect) { | 185 DrawBitmapRect4(bool useIRect) : fUseIRect(useIRect) { |
| 186 this->setBGColor(0x88444444); | 186 this->setBGColor(0x88444444); |
| 187 } | 187 } |
| 188 | 188 |
| 189 protected: | 189 protected: |
| 190 virtual SkString onShortName() SK_OVERRIDE { | 190 SkString onShortName() SK_OVERRIDE { |
| 191 SkString str; | 191 SkString str; |
| 192 str.printf("bigbitmaprect_%s", fUseIRect ? "i" : "s"); | 192 str.printf("bigbitmaprect_%s", fUseIRect ? "i" : "s"); |
| 193 return str; | 193 return str; |
| 194 } | 194 } |
| 195 | 195 |
| 196 virtual SkISize onISize() SK_OVERRIDE { | 196 SkISize onISize() SK_OVERRIDE { |
| 197 return SkISize::Make(640, 480); | 197 return SkISize::Make(640, 480); |
| 198 } | 198 } |
| 199 | 199 |
| 200 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 200 void onOnceBeforeDraw() SK_OVERRIDE { |
| 201 make_big_bitmap(&fBigBitmap); | 201 make_big_bitmap(&fBigBitmap); |
| 202 } | 202 } |
| 203 | 203 |
| 204 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 204 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 205 | 205 |
| 206 SkXfermode* mode = SkXfermode::Create(SkXfermode::kXor_Mode); | 206 SkXfermode* mode = SkXfermode::Create(SkXfermode::kXor_Mode); |
| 207 | 207 |
| 208 SkPaint paint; | 208 SkPaint paint; |
| 209 paint.setAlpha(128); | 209 paint.setAlpha(128); |
| 210 paint.setXfermode(mode)->unref(); | 210 paint.setXfermode(mode)->unref(); |
| 211 | 211 |
| 212 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f }; | 212 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f }; |
| 213 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f }; | 213 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f }; |
| 214 | 214 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 static skiagm::GMRegistry reg0(MyFactory0); | 292 static skiagm::GMRegistry reg0(MyFactory0); |
| 293 static skiagm::GMRegistry reg1(MyFactory1); | 293 static skiagm::GMRegistry reg1(MyFactory1); |
| 294 | 294 |
| 295 static skiagm::GMRegistry reg2(MyFactory2); | 295 static skiagm::GMRegistry reg2(MyFactory2); |
| 296 | 296 |
| 297 #ifndef SK_BUILD_FOR_ANDROID | 297 #ifndef SK_BUILD_FOR_ANDROID |
| 298 static skiagm::GMRegistry reg3(MyFactory3); | 298 static skiagm::GMRegistry reg3(MyFactory3); |
| 299 static skiagm::GMRegistry reg4(MyFactory4); | 299 static skiagm::GMRegistry reg4(MyFactory4); |
| 300 #endif | 300 #endif |
| 301 | 301 |
| OLD | NEW |