| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkBitmapDevice.h" | 9 #include "SkBitmapDevice.h" |
| 10 #include "SkBitmapSource.h" | 10 #include "SkBitmapSource.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "SkGpuDevice.h" | 37 #include "SkGpuDevice.h" |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 static const int kBitmapSize = 4; | 40 static const int kBitmapSize = 4; |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 class MatrixTestImageFilter : public SkImageFilter { | 44 class MatrixTestImageFilter : public SkImageFilter { |
| 45 public: | 45 public: |
| 46 MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expected
Matrix) | 46 MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expected
Matrix) |
| 47 : SkImageFilter(0), fReporter(reporter), fExpectedMatrix(expectedMatrix) { | 47 : SkImageFilter(0, NULL), fReporter(reporter), fExpectedMatrix(expectedMat
rix) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context& ctx, | 50 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context& ctx, |
| 51 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE { | 51 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE { |
| 52 REPORTER_ASSERT(fReporter, ctx.ctm() == fExpectedMatrix); | 52 REPORTER_ASSERT(fReporter, ctx.ctm() == fExpectedMatrix); |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter) | 56 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter) |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 explicit MatrixTestImageFilter(SkReadBuffer& buffer) : SkImageFilter(0) { | 59 explicit MatrixTestImageFilter(SkReadBuffer& buffer) : SkImageFilter(0, NULL
) { |
| 60 fReporter = static_cast<skiatest::Reporter*>(buffer.readFunctionPtr()); | 60 fReporter = static_cast<skiatest::Reporter*>(buffer.readFunctionPtr()); |
| 61 buffer.readMatrix(&fExpectedMatrix); | 61 buffer.readMatrix(&fExpectedMatrix); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { | 64 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { |
| 65 buffer.writeFunctionPtr(fReporter); | 65 buffer.writeFunctionPtr(fReporter); |
| 66 buffer.writeMatrix(fExpectedMatrix); | 66 buffer.writeMatrix(fExpectedMatrix); |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } | 761 } |
| 762 | 762 |
| 763 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { | 763 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { |
| 764 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 764 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
| 765 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 765 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
| 766 SkImageInfo::MakeN32Pre
mul(1, 1), | 766 SkImageInfo::MakeN32Pre
mul(1, 1), |
| 767 0)); | 767 0)); |
| 768 test_xfermode_cropped_input(device, reporter); | 768 test_xfermode_cropped_input(device, reporter); |
| 769 } | 769 } |
| 770 #endif | 770 #endif |
| OLD | NEW |