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

Side by Side Diff: tests/LayerDrawLooperTest.cpp

Issue 168653002: Change device factories to take SkImageInfo instead of SkBitmap::Config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix PdfViewer Created 6 years, 10 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/ImageFilterTest.cpp ('k') | tests/PremulAlphaRoundTripTest.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 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapDevice.h" 9 #include "SkBitmapDevice.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkDraw.h" 11 #include "SkDraw.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 #include "Test.h" 19 #include "Test.h"
20 20
21 static SkBitmap make_bm(int w, int h) {
22 SkBitmap bm;
23 bm.allocN32Pixels(w, h);
24 return bm;
25 }
26
21 class FakeDevice : public SkBitmapDevice { 27 class FakeDevice : public SkBitmapDevice {
22 public: 28 public:
23 FakeDevice() : SkBitmapDevice(SkBitmap::kARGB_8888_Config, 100, 100, false) { } 29 FakeDevice() : SkBitmapDevice(make_bm(100, 100)) { }
24 30
25 virtual void drawRect(const SkDraw& draw, const SkRect& r, 31 virtual void drawRect(const SkDraw& draw, const SkRect& r,
26 const SkPaint& paint) SK_OVERRIDE { 32 const SkPaint& paint) SK_OVERRIDE {
27 fLastMatrix = *draw.fMatrix; 33 fLastMatrix = *draw.fMatrix;
28 INHERITED::drawRect(draw, r, paint); 34 INHERITED::drawRect(draw, r, paint);
29 } 35 }
30 36
31 SkMatrix fLastMatrix; 37 SkMatrix fLastMatrix;
32 38
33 private: 39 private:
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 152
147 // Only two layers were added, so that should be the end. 153 // Only two layers were added, so that should be the end.
148 REPORTER_ASSERT(reporter, !looper->next(&canvas, &paint)); 154 REPORTER_ASSERT(reporter, !looper->next(&canvas, &paint));
149 } 155 }
150 156
151 DEF_TEST(LayerDrawLooper, reporter) { 157 DEF_TEST(LayerDrawLooper, reporter) {
152 test_frontToBack(reporter); 158 test_frontToBack(reporter);
153 test_backToFront(reporter); 159 test_backToFront(reporter);
154 test_mixed(reporter); 160 test_mixed(reporter);
155 } 161 }
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tests/PremulAlphaRoundTripTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698