OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 9 |
10 #include "SkArithmeticMode.h" | 10 #include "SkArithmeticMode.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 *dst = device->accessBitmap(false); | 59 *dst = device->accessBitmap(false); |
60 offset->fX += bounds.left(); | 60 offset->fX += bounds.left(); |
61 offset->fY += bounds.top(); | 61 offset->fY += bounds.top(); |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
65 SK_TO_STRING_OVERRIDE() | 65 SK_TO_STRING_OVERRIDE() |
66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SimpleOffsetFilter); | 66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SimpleOffsetFilter); |
67 | 67 |
68 protected: | 68 protected: |
69 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { | 69 void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { |
70 this->INHERITED::flatten(buffer); | 70 this->INHERITED::flatten(buffer); |
71 buffer.writeScalar(fDX); | 71 buffer.writeScalar(fDX); |
72 buffer.writeScalar(fDY); | 72 buffer.writeScalar(fDY); |
73 } | 73 } |
74 | 74 |
75 private: | 75 private: |
76 SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input) | 76 SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input) |
77 : SkImageFilter(1, &input), fDX(dx), fDY(dy) {} | 77 : SkImageFilter(1, &input), fDX(dx), fDY(dy) {} |
78 | 78 |
79 SkScalar fDX, fDY; | 79 SkScalar fDX, fDY; |
(...skipping 15 matching lines...) Expand all Loading... |
95 str->appendf("SimpleOffsetFilter: ("); | 95 str->appendf("SimpleOffsetFilter: ("); |
96 str->append(")"); | 96 str->append(")"); |
97 } | 97 } |
98 #endif | 98 #endif |
99 | 99 |
100 class ImageFiltersGraphGM : public skiagm::GM { | 100 class ImageFiltersGraphGM : public skiagm::GM { |
101 public: | 101 public: |
102 ImageFiltersGraphGM() {} | 102 ImageFiltersGraphGM() {} |
103 | 103 |
104 protected: | 104 protected: |
105 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 105 uint32_t onGetFlags() const SK_OVERRIDE { |
106 return kSkipTiled_Flag; | 106 return kSkipTiled_Flag; |
107 } | 107 } |
108 | 108 |
109 virtual SkString onShortName() { | 109 virtual SkString onShortName() { |
110 return SkString("imagefiltersgraph"); | 110 return SkString("imagefiltersgraph"); |
111 } | 111 } |
112 | 112 |
113 void make_bitmap() { | 113 void make_bitmap() { |
114 fBitmap.allocN32Pixels(100, 100); | 114 fBitmap.allocN32Pixels(100, 100); |
115 SkCanvas canvas(fBitmap); | 115 SkCanvas canvas(fBitmap); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 private: | 228 private: |
229 typedef GM INHERITED; | 229 typedef GM INHERITED; |
230 SkBitmap fBitmap; | 230 SkBitmap fBitmap; |
231 }; | 231 }; |
232 | 232 |
233 /////////////////////////////////////////////////////////////////////////////// | 233 /////////////////////////////////////////////////////////////////////////////// |
234 | 234 |
235 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } | 235 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } |
236 static skiagm::GMRegistry reg(MyFactory); | 236 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |