| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBlitter.h" | 8 #include "SkBlitter.h" |
| 9 #include "SkMask.h" | 9 #include "SkMask.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| 11 #include <string.h> | 11 #include <string.h> |
| 12 | 12 |
| 13 class TestBlitter : public SkBlitter { | 13 class TestBlitter : public SkBlitter { |
| 14 public: | 14 public: |
| 15 TestBlitter(SkIRect bounds, skiatest::Reporter* reporter) | 15 TestBlitter(SkIRect bounds, skiatest::Reporter* reporter) |
| 16 : fBounds(bounds) | 16 : fBounds(bounds) |
| 17 , fReporter(reporter) { } | 17 , fReporter(reporter) { } |
| 18 | 18 |
| 19 void blitH(int x, int y, int width) override { | 19 void blitH(int x, int y, int width) override { |
| 20 | 20 |
| 21 REPORTER_ASSERT(fReporter, x >= fBounds.fLeft && x < fBounds.fRight); | 21 REPORTER_ASSERT(fReporter, x >= fBounds.fLeft && x < fBounds.fRight); |
| 22 REPORTER_ASSERT(fReporter, y >= fBounds.fTop && y < fBounds.fBottom); | 22 REPORTER_ASSERT(fReporter, y >= fBounds.fTop && y < fBounds.fBottom); |
| 23 int right = x + width; | 23 int right = x + width; |
| 24 REPORTER_ASSERT(fReporter, right > fBounds.fLeft && right <= fBounds.fRi
ght); | 24 REPORTER_ASSERT(fReporter, right > fBounds.fLeft && right <= fBounds.fRi
ght); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]
) override { |
| 28 SkDEBUGFAIL("blitAntiH not implemented"); |
| 29 } |
| 30 |
| 27 private: | 31 private: |
| 28 SkIRect fBounds; | 32 SkIRect fBounds; |
| 29 skiatest::Reporter* fReporter; | 33 skiatest::Reporter* fReporter; |
| 30 }; | 34 }; |
| 31 | 35 |
| 32 // Exercise all clips compared with different widths of bitMask. Make sure that
no buffer | 36 // Exercise all clips compared with different widths of bitMask. Make sure that
no buffer |
| 33 // overruns happen. | 37 // overruns happen. |
| 34 DEF_TEST(BlitAndClip, reporter) { | 38 DEF_TEST(BlitAndClip, reporter) { |
| 35 const int originX = 100; | 39 const int originX = 100; |
| 36 const int originY = 100; | 40 const int originY = 100; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 57 SkIRect clipRect = {left, top, right, bottom}; | 61 SkIRect clipRect = {left, top, right, bottom}; |
| 58 tb.blitMask(mask, clipRect); | 62 tb.blitMask(mask, clipRect); |
| 59 } | 63 } |
| 60 } | 64 } |
| 61 } | 65 } |
| 62 } | 66 } |
| 63 | 67 |
| 64 delete [] bits; | 68 delete [] bits; |
| 65 } | 69 } |
| 66 } | 70 } |
| OLD | NEW |