| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 &paint); | 95 &paint); |
| 96 } | 96 } |
| 97 | 97 |
| 98 /////////////////////////////////////////////////////////////////////////////// | 98 /////////////////////////////////////////////////////////////////////////////// |
| 99 | 99 |
| 100 class ImageFiltersCroppedGM : public skiagm::GM { | 100 class ImageFiltersCroppedGM : public skiagm::GM { |
| 101 public: | 101 public: |
| 102 ImageFiltersCroppedGM () {} | 102 ImageFiltersCroppedGM () {} |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 | |
| 106 virtual SkString onShortName() { | 105 virtual SkString onShortName() { |
| 107 return SkString("imagefilterscropped"); | 106 return SkString("imagefilterscropped"); |
| 108 } | 107 } |
| 109 | 108 |
| 110 virtual SkISize onISize() { return SkISize::Make(400, 640); } | 109 virtual SkISize onISize() { return SkISize::Make(400, 640); } |
| 111 | 110 |
| 112 void draw_frame(SkCanvas* canvas, const SkRect& r) { | 111 void draw_frame(SkCanvas* canvas, const SkRect& r) { |
| 113 SkPaint paint; | 112 SkPaint paint; |
| 114 paint.setStyle(SkPaint::kStroke_Style); | 113 paint.setStyle(SkPaint::kStroke_Style); |
| 115 paint.setColor(SK_ColorRED); | 114 paint.setColor(SK_ColorRED); |
| 116 canvas->drawRect(r, paint); | 115 canvas->drawRect(r, paint); |
| 117 } | 116 } |
| 118 | 117 |
| 119 virtual uint32_t onGetFlags() const { | 118 virtual uint32_t onGetFlags() const { |
| 120 // Because of the use of drawSprite, this test is excluded | 119 // Because of the use of drawSprite, this test is excluded |
| 121 // from scaled replay tests because drawSprite ignores the | 120 // from scaled replay tests because drawSprite ignores the |
| 122 // reciprocal scale that is applied at record time, which is | 121 // reciprocal scale that is applied at record time, which is |
| 123 // the intended behavior of drawSprite. | 122 // the intended behavior of drawSprite. |
| 124 return kSkipScaledReplay_Flag; | 123 return kSkipScaledReplay_Flag | kSkipTiled_Flag; |
| 125 } | 124 } |
| 126 | 125 |
| 127 virtual void onDraw(SkCanvas* canvas) { | 126 virtual void onDraw(SkCanvas* canvas) { |
| 128 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { | 127 void (*drawProc[])(SkCanvas*, const SkRect&, SkImageFilter*) = { |
| 129 draw_sprite, draw_bitmap, draw_path, draw_paint, draw_text | 128 draw_sprite, draw_bitmap, draw_path, draw_paint, draw_text |
| 130 }; | 129 }; |
| 131 | 130 |
| 132 SkAutoTUnref<SkColorFilter> cf( | 131 SkAutoTUnref<SkColorFilter> cf( |
| 133 SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mod
e)); | 132 SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mod
e)); |
| 134 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); | 133 SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10,
44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 172 } |
| 174 | 173 |
| 175 private: | 174 private: |
| 176 typedef GM INHERITED; | 175 typedef GM INHERITED; |
| 177 }; | 176 }; |
| 178 | 177 |
| 179 /////////////////////////////////////////////////////////////////////////////// | 178 /////////////////////////////////////////////////////////////////////////////// |
| 180 | 179 |
| 181 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } | 180 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } |
| 182 static skiagm::GMRegistry reg(MyFactory); | 181 static skiagm::GMRegistry reg(MyFactory); |
| OLD | NEW |