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

Side by Side Diff: tests/QuickRejectTest.cpp

Issue 841753002: Remove macros that make it look like it's a good idea to not be able to flatten. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: DummyRasterizer too Created 5 years, 11 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
« no previous file with comments | « tests/LayerRasterizerTest.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 * 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkDrawLooper.h" 9 #include "SkDrawLooper.h"
10 #include "SkTypes.h" 10 #include "SkTypes.h"
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 22
23 virtual size_t contextSize() const SK_OVERRIDE { return sizeof(TestDrawLoope rContext); } 23 virtual size_t contextSize() const SK_OVERRIDE { return sizeof(TestDrawLoope rContext); }
24 24
25 #ifndef SK_IGNORE_TO_STRING 25 #ifndef SK_IGNORE_TO_STRING
26 virtual void toString(SkString* str) const SK_OVERRIDE { 26 virtual void toString(SkString* str) const SK_OVERRIDE {
27 str->append("TestLooper:"); 27 str->append("TestLooper:");
28 } 28 }
29 #endif 29 #endif
30 30
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestLooper);
32
31 private: 33 private:
32 class TestDrawLooperContext : public SkDrawLooper::Context { 34 class TestDrawLooperContext : public SkDrawLooper::Context {
33 public: 35 public:
34 TestDrawLooperContext() : fOnce(true) {} 36 TestDrawLooperContext() : fOnce(true) {}
35 virtual ~TestDrawLooperContext() {} 37 virtual ~TestDrawLooperContext() {}
36 38
37 virtual bool next(SkCanvas* canvas, SkPaint*) SK_OVERRIDE { 39 virtual bool next(SkCanvas* canvas, SkPaint*) SK_OVERRIDE {
38 if (fOnce) { 40 if (fOnce) {
39 fOnce = false; 41 fOnce = false;
40 canvas->translate(SkIntToScalar(10), 0); 42 canvas->translate(SkIntToScalar(10), 0);
41 return true; 43 return true;
42 } 44 }
43 return false; 45 return false;
44 } 46 }
45 private: 47 private:
46 bool fOnce; 48 bool fOnce;
47 }; 49 };
50 };
48 51
49 SK_DECLARE_UNFLATTENABLE_OBJECT() 52 SkFlattenable* TestLooper::CreateProc(SkReadBuffer&) { return SkNEW(TestLooper); }
50 };
51 53
52 static void test_drawBitmap(skiatest::Reporter* reporter) { 54 static void test_drawBitmap(skiatest::Reporter* reporter) {
53 SkBitmap src; 55 SkBitmap src;
54 src.allocN32Pixels(10, 10); 56 src.allocN32Pixels(10, 10);
55 src.eraseColor(SK_ColorWHITE); 57 src.eraseColor(SK_ColorWHITE);
56 58
57 SkBitmap dst; 59 SkBitmap dst;
58 dst.allocN32Pixels(10, 10); 60 dst.allocN32Pixels(10, 10);
59 dst.eraseColor(SK_ColorTRANSPARENT); 61 dst.eraseColor(SK_ColorTRANSPARENT);
60 62
(...skipping 20 matching lines...) Expand all
81 // allows us through, even though sans-looper we would look like we should 83 // allows us through, even though sans-looper we would look like we should
82 // be clipped out. 84 // be clipped out.
83 paint.setLooper(new TestLooper)->unref(); 85 paint.setLooper(new TestLooper)->unref();
84 canvas.drawBitmap(src, SkIntToScalar(-10), 0, &paint); 86 canvas.drawBitmap(src, SkIntToScalar(-10), 0, &paint);
85 REPORTER_ASSERT(reporter, 0xFFFFFFFF == *dst.getAddr32(5, 5)); 87 REPORTER_ASSERT(reporter, 0xFFFFFFFF == *dst.getAddr32(5, 5));
86 } 88 }
87 89
88 DEF_TEST(QuickReject, reporter) { 90 DEF_TEST(QuickReject, reporter) {
89 test_drawBitmap(reporter); 91 test_drawBitmap(reporter);
90 } 92 }
OLDNEW
« no previous file with comments | « tests/LayerRasterizerTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698