| 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 "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 virtual SkISize onISize() { return SkISize::Make(400, 640); } | 101 virtual SkISize onISize() { return SkISize::Make(400, 640); } |
| 102 | 102 |
| 103 void draw_frame(SkCanvas* canvas, const SkRect& r) { | 103 void draw_frame(SkCanvas* canvas, const SkRect& r) { |
| 104 SkPaint paint; | 104 SkPaint paint; |
| 105 paint.setStyle(SkPaint::kStroke_Style); | 105 paint.setStyle(SkPaint::kStroke_Style); |
| 106 paint.setColor(SK_ColorRED); | 106 paint.setColor(SK_ColorRED); |
| 107 canvas->drawRect(r, paint); | 107 canvas->drawRect(r, paint); |
| 108 } | 108 } |
| 109 | 109 |
| 110 virtual uint32_t onGetFlags() const { | |
| 111 // Because of the use of drawSprite, this test is excluded | |
| 112 // from scaled replay tests because drawSprite ignores the | |
| 113 // reciprocal scale that is applied at record time, which is | |
| 114 // the intended behavior of drawSprite. | |
| 115 return kSkipScaledReplay_Flag | kSkipTiled_Flag; | |
| 116 } | |
| 117 | |
| 118 virtual void onDraw(SkCanvas* canvas) { | 110 virtual void onDraw(SkCanvas* canvas) { |
| 119 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { | 111 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { |
| 120 draw_sprite, draw_bitmap, draw_path, draw_paint, draw_text | 112 draw_sprite, draw_bitmap, draw_path, draw_paint, draw_text |
| 121 }; | 113 }; |
| 122 | 114 |
| 123 SkAutoTUnref<SkColorFilter> cf( | 115 SkAutoTUnref<SkColorFilter> cf( |
| 124 SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mod
e)); | 116 SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mod
e)); |
| 125 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); | 117 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); |
| 126 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -
100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge); | 118 SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -
100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge); |
| 127 | 119 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 156 } |
| 165 | 157 |
| 166 private: | 158 private: |
| 167 typedef GM INHERITED; | 159 typedef GM INHERITED; |
| 168 }; | 160 }; |
| 169 | 161 |
| 170 /////////////////////////////////////////////////////////////////////////////// | 162 /////////////////////////////////////////////////////////////////////////////// |
| 171 | 163 |
| 172 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } | 164 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } |
| 173 static skiagm::GMRegistry reg(MyFactory); | 165 static skiagm::GMRegistry reg(MyFactory); |
| OLD | NEW |