OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
11 #include "SkDiscardableMemoryPool.h" | 11 #include "SkDiscardableMemoryPool.h" |
12 #include "SkImageGeneratorPriv.h" | 12 #include "SkImageGeneratorPriv.h" |
13 #include "SkMatrixUtils.h" | 13 #include "SkMatrixUtils.h" |
14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
15 #include "SkRandom.h" | 15 #include "SkRandom.h" |
16 #include "SkShader.h" | 16 #include "SkShader.h" |
17 #include "SkSurface.h" | 17 #include "SkSurface.h" |
18 #include "Test.h" | 18 #include "Test.h" |
19 | 19 |
20 // A BitmapFactory that always fails when asked to return pixels. | 20 // A BitmapFactory that always fails when asked to return pixels. |
21 class FailureImageGenerator : public SkImageGenerator { | 21 class FailureImageGenerator : public SkImageGenerator { |
22 public: | 22 public: |
23 FailureImageGenerator() { } | 23 FailureImageGenerator() { } |
24 virtual ~FailureImageGenerator() { } | 24 virtual ~FailureImageGenerator() { } |
25 | 25 |
26 protected: | 26 protected: |
27 virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { | 27 virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { |
28 info->fWidth = 100; | 28 *info = SkImageInfo::MakeN32Premul(100, 100); |
29 info->fHeight = 100; | |
30 info->fColorType = kN32_SkColorType; | |
31 info->fAlphaType = kPremul_SkAlphaType; | |
32 return true; | 29 return true; |
33 } | 30 } |
34 // default onGetPixels() returns false, which is what we want. | 31 // default onGetPixels() returns false, which is what we want. |
35 }; | 32 }; |
36 | 33 |
37 // crbug.com/295895 | 34 // crbug.com/295895 |
38 // Crashing in skia when a pixelref fails in lockPixels | 35 // Crashing in skia when a pixelref fails in lockPixels |
39 // | 36 // |
40 static void test_faulty_pixelref(skiatest::Reporter* reporter) { | 37 static void test_faulty_pixelref(skiatest::Reporter* reporter) { |
41 // need a cache, but don't expect to use it, so the budget is not critical | 38 // need a cache, but don't expect to use it, so the budget is not critical |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 309 |
313 // ensure that we draw nothing if srcR does not intersect the bitmap | 310 // ensure that we draw nothing if srcR does not intersect the bitmap |
314 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); | 311 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); |
315 | 312 |
316 test_nan_antihair(); | 313 test_nan_antihair(); |
317 test_giantrepeat_crbug118018(reporter); | 314 test_giantrepeat_crbug118018(reporter); |
318 | 315 |
319 test_treatAsSprite(reporter); | 316 test_treatAsSprite(reporter); |
320 test_faulty_pixelref(reporter); | 317 test_faulty_pixelref(reporter); |
321 } | 318 } |
OLD | NEW |