Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tests/FlatDataTest.cpp

Issue 15070011: One SkTSearch to rule them all. Allow key to be of different type than the array. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fixes to compile on gcc Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/utils/win/SkWGL_win.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « src/utils/win/SkWGL_win.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698