OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 */ | 40 */ |
41 static void testCreate(skiatest::Reporter* reporter, const void* obj, | 41 static void testCreate(skiatest::Reporter* reporter, const void* obj, |
42 void (*flattenProc)(SkOrderedWriteBuffer&, const void*))
{ | 42 void (*flattenProc)(SkOrderedWriteBuffer&, const void*))
{ |
43 Controller controller; | 43 Controller controller; |
44 // No need to delete data because that will be taken care of by the | 44 // No need to delete data because that will be taken care of by the |
45 // controller. | 45 // controller. |
46 SkFlatData* data1 = SkFlatData::Create(&controller, obj, 0, flattenProc); | 46 SkFlatData* data1 = SkFlatData::Create(&controller, obj, 0, flattenProc); |
47 data1->setSentinelInCache(); | 47 data1->setSentinelInCache(); |
48 SkFlatData* data2 = SkFlatData::Create(&controller, obj, 1, flattenProc); | 48 SkFlatData* data2 = SkFlatData::Create(&controller, obj, 1, flattenProc); |
49 data2->setSentinelAsCandidate(); | 49 data2->setSentinelAsCandidate(); |
50 REPORTER_ASSERT(reporter, SkFlatData::Compare(data1, data2) == 0); | 50 REPORTER_ASSERT(reporter, SkFlatData::Compare(*data1, *data2) == 0); |
51 } | 51 } |
52 | 52 |
53 static void Tests(skiatest::Reporter* reporter) { | 53 static void Tests(skiatest::Reporter* reporter) { |
54 // Test flattening SkShader | 54 // Test flattening SkShader |
55 SkPoint points[2]; | 55 SkPoint points[2]; |
56 points[0].set(0, 0); | 56 points[0].set(0, 0); |
57 points[1].set(SkIntToScalar(20), SkIntToScalar(20)); | 57 points[1].set(SkIntToScalar(20), SkIntToScalar(20)); |
58 SkColor colors[2]; | 58 SkColor colors[2]; |
59 colors[0] = SK_ColorRED; | 59 colors[0] = SK_ColorRED; |
60 colors[1] = SK_ColorBLUE; | 60 colors[1] = SK_ColorBLUE; |
(...skipping 21 matching lines...) Expand all Loading... |
82 testCreate(reporter, cf, &flattenFlattenableProc); | 82 testCreate(reporter, cf, &flattenFlattenableProc); |
83 | 83 |
84 // Test SkXfermode | 84 // Test SkXfermode |
85 SkXfermode* xfer = SkXfermode::Create(SkXfermode::kDstOver_Mode); | 85 SkXfermode* xfer = SkXfermode::Create(SkXfermode::kDstOver_Mode); |
86 SkAutoUnref aurxf(xfer); | 86 SkAutoUnref aurxf(xfer); |
87 testCreate(reporter, xfer, &flattenFlattenableProc); | 87 testCreate(reporter, xfer, &flattenFlattenableProc); |
88 } | 88 } |
89 | 89 |
90 #include "TestClassDef.h" | 90 #include "TestClassDef.h" |
91 DEFINE_TESTCLASS("FlatData", FlatDataClass, Tests) | 91 DEFINE_TESTCLASS("FlatData", FlatDataClass, Tests) |
OLD | NEW |