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 /* Description: | 8 /* Description: |
9 * This test defines a series of elementatry test steps that perform | 9 * This test defines a series of elementatry test steps that perform |
10 * a single or a small group of canvas API calls. Each test step is | 10 * a single or a small group of canvas API calls. Each test step is |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 SkIRect ar, br; | 185 SkIRect ar, br; |
186 a.getClipDeviceBounds(&ar); | 186 a.getClipDeviceBounds(&ar); |
187 b.getClipDeviceBounds(&br); | 187 b.getClipDeviceBounds(&br); |
188 return ar == br; | 188 return ar == br; |
189 } | 189 } |
190 | 190 |
191 class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { | 191 class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { |
192 public: | 192 public: |
193 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {} | 193 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {} |
194 | 194 |
195 virtual void clipRect(const SkRect& r, SkRegion::Op op, bool aa) SK_OVERRIDE
{ | 195 void clipRect(const SkRect& r, SkRegion::Op op, bool aa) SK_OVERRIDE { |
196 fTarget->clipRect(r, op, aa); | 196 fTarget->clipRect(r, op, aa); |
197 } | 197 } |
198 virtual void clipRRect(const SkRRect& r, SkRegion::Op op, bool aa) SK_OVERRI
DE { | 198 void clipRRect(const SkRRect& r, SkRegion::Op op, bool aa) SK_OVERRIDE { |
199 fTarget->clipRRect(r, op, aa); | 199 fTarget->clipRRect(r, op, aa); |
200 } | 200 } |
201 virtual void clipPath(const SkPath& p, SkRegion::Op op, bool aa) SK_OVERRIDE
{ | 201 void clipPath(const SkPath& p, SkRegion::Op op, bool aa) SK_OVERRIDE { |
202 fTarget->clipPath(p, op, aa); | 202 fTarget->clipPath(p, op, aa); |
203 } | 203 } |
204 | 204 |
205 private: | 205 private: |
206 SkCanvas* fTarget; | 206 SkCanvas* fTarget; |
207 }; | 207 }; |
208 | 208 |
209 static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) { | 209 static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) { |
210 SkISize size = canvas->getDeviceSize(); | 210 SkISize size = canvas->getDeviceSize(); |
211 | 211 |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 | 778 |
779 n = canvas.saveLayer(NULL, NULL); | 779 n = canvas.saveLayer(NULL, NULL); |
780 REPORTER_ASSERT(reporter, 2 == n); | 780 REPORTER_ASSERT(reporter, 2 == n); |
781 REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount()); | 781 REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount()); |
782 | 782 |
783 canvas.restore(); | 783 canvas.restore(); |
784 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); | 784 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); |
785 canvas.restore(); | 785 canvas.restore(); |
786 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); | 786 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); |
787 } | 787 } |
OLD | NEW |