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

Side by Side Diff: tests/LayerDrawLooperTest.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 3 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 | « tests/GradientTest.cpp ('k') | tests/PictureTest.cpp » ('j') | 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 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 #include "Test.h" 7 #include "Test.h"
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 10 #include "SkCanvas.h"
10 #include "SkDraw.h" 11 #include "SkDraw.h"
11 #include "SkDevice.h"
12 #include "SkLayerDrawLooper.h" 12 #include "SkLayerDrawLooper.h"
13 #include "SkMatrix.h" 13 #include "SkMatrix.h"
14 #include "SkPaint.h" 14 #include "SkPaint.h"
15 #include "SkRect.h" 15 #include "SkRect.h"
16 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
17 #include "SkScalar.h" 17 #include "SkScalar.h"
18 #include "SkXfermode.h" 18 #include "SkXfermode.h"
19 19
20 namespace { 20 namespace {
21 21
22 class FakeDevice : public SkDevice { 22 class FakeDevice : public SkBitmapDevice {
23 public: 23 public:
24 FakeDevice() : SkDevice(SkBitmap::kARGB_8888_Config, 100, 100) { } 24 FakeDevice() : SkBitmapDevice(SkBitmap::kARGB_8888_Config, 100, 100, false) { }
25 25
26 virtual void drawRect(const SkDraw& draw, const SkRect& r, 26 virtual void drawRect(const SkDraw& draw, const SkRect& r,
27 const SkPaint& paint) SK_OVERRIDE { 27 const SkPaint& paint) SK_OVERRIDE {
28 fLastMatrix = *draw.fMatrix; 28 fLastMatrix = *draw.fMatrix;
29 SkDevice::drawRect(draw, r, paint); 29 INHERITED::drawRect(draw, r, paint);
30 } 30 }
31 31
32 SkMatrix fLastMatrix; 32 SkMatrix fLastMatrix;
33
34 private:
35 typedef SkBitmapDevice INHERITED;
33 }; 36 };
34 37
35 } // namespace 38 } // namespace
36 39
37 static void test_frontToBack(skiatest::Reporter* reporter) { 40 static void test_frontToBack(skiatest::Reporter* reporter) {
38 SkAutoTUnref<SkLayerDrawLooper> looper(SkNEW(SkLayerDrawLooper)); 41 SkAutoTUnref<SkLayerDrawLooper> looper(SkNEW(SkLayerDrawLooper));
39 SkLayerDrawLooper::LayerInfo layerInfo; 42 SkLayerDrawLooper::LayerInfo layerInfo;
40 43
41 // Add the front layer, with the defaults. 44 // Add the front layer, with the defaults.
42 (void)looper->addLayer(layerInfo); 45 (void)looper->addLayer(layerInfo);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 149 }
147 150
148 static void TestLayerDrawLooper(skiatest::Reporter* reporter) { 151 static void TestLayerDrawLooper(skiatest::Reporter* reporter) {
149 test_frontToBack(reporter); 152 test_frontToBack(reporter);
150 test_backToFront(reporter); 153 test_backToFront(reporter);
151 test_mixed(reporter); 154 test_mixed(reporter);
152 } 155 }
153 156
154 #include "TestClassDef.h" 157 #include "TestClassDef.h"
155 DEFINE_TESTCLASS("LayerDrawLooper", TestLayerDrawLooperClass, TestLayerDrawLoope r) 158 DEFINE_TESTCLASS("LayerDrawLooper", TestLayerDrawLooperClass, TestLayerDrawLoope r)
OLDNEW
« no previous file with comments | « tests/GradientTest.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698