| 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 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 SkAutoTUnref<SkImageFilter> filter(SkImageSource::Create(image)); | 1222 SkAutoTUnref<SkImageFilter> filter(SkImageSource::Create(image)); |
| 1223 | 1223 |
| 1224 SkAutoTUnref<SkData> data(SkValidatingSerializeFlattenable(filter)); | 1224 SkAutoTUnref<SkData> data(SkValidatingSerializeFlattenable(filter)); |
| 1225 SkAutoTUnref<SkFlattenable> flattenable(SkValidatingDeserializeFlattenable( | 1225 SkAutoTUnref<SkFlattenable> flattenable(SkValidatingDeserializeFlattenable( |
| 1226 data->data(), data->size(), SkImageFilter::GetFlattenableType())); | 1226 data->data(), data->size(), SkImageFilter::GetFlattenableType())); |
| 1227 SkImageFilter* unflattenedFilter = static_cast<SkImageFilter*>(flattenable.g
et()); | 1227 SkImageFilter* unflattenedFilter = static_cast<SkImageFilter*>(flattenable.g
et()); |
| 1228 REPORTER_ASSERT(reporter, unflattenedFilter); | 1228 REPORTER_ASSERT(reporter, unflattenedFilter); |
| 1229 | 1229 |
| 1230 SkBitmap bm; | 1230 SkBitmap bm; |
| 1231 bm.allocN32Pixels(10, 10); | 1231 bm.allocN32Pixels(10, 10); |
| 1232 bm.eraseColor(SK_ColorBLUE); |
| 1232 SkPaint paint; | 1233 SkPaint paint; |
| 1233 paint.setColor(SK_ColorRED); | 1234 paint.setColor(SK_ColorRED); |
| 1234 paint.setImageFilter(unflattenedFilter); | 1235 paint.setImageFilter(unflattenedFilter); |
| 1235 | 1236 |
| 1236 SkCanvas canvas(bm); | 1237 SkCanvas canvas(bm); |
| 1237 canvas.drawRect(SkRect::MakeWH(10, 10), paint); | 1238 canvas.drawRect(SkRect::MakeWH(10, 10), paint); |
| 1238 REPORTER_ASSERT(reporter, *bm.getAddr32(0, 0) == SkPreMultiplyColor(SK_Color
GREEN)); | 1239 REPORTER_ASSERT(reporter, *bm.getAddr32(0, 0) == SkPreMultiplyColor(SK_Color
GREEN)); |
| 1239 } | 1240 } |
| 1240 | 1241 |
| 1241 #if SK_SUPPORT_GPU | 1242 #if SK_SUPPORT_GPU |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 SkSurface::kNo_Budgeted
, | 1306 SkSurface::kNo_Budgeted
, |
| 1306 SkImageInfo::MakeN32Pre
mul(1, 1), | 1307 SkImageInfo::MakeN32Pre
mul(1, 1), |
| 1307 0, | 1308 0, |
| 1308 &props, | 1309 &props, |
| 1309 SkGpuDevice::kUninit_In
itContents)); | 1310 SkGpuDevice::kUninit_In
itContents)); |
| 1310 SkImageFilter::Proxy proxy(device); | 1311 SkImageFilter::Proxy proxy(device); |
| 1311 | 1312 |
| 1312 test_negative_blur_sigma(&proxy, reporter); | 1313 test_negative_blur_sigma(&proxy, reporter); |
| 1313 } | 1314 } |
| 1314 #endif | 1315 #endif |
| OLD | NEW |