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

Side by Side Diff: tests/PictureTest.cpp

Issue 865873003: remove more dead code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 28 matching lines...) Expand all
39 #include "SkColorFilterImageFilter.h" 39 #include "SkColorFilterImageFilter.h"
40 40
41 static void make_bm(SkBitmap* bm, int w, int h, SkColor color, bool immutable) { 41 static void make_bm(SkBitmap* bm, int w, int h, SkColor color, bool immutable) {
42 bm->allocN32Pixels(w, h); 42 bm->allocN32Pixels(w, h);
43 bm->eraseColor(color); 43 bm->eraseColor(color);
44 if (immutable) { 44 if (immutable) {
45 bm->setImmutable(); 45 bm->setImmutable();
46 } 46 }
47 } 47 }
48 48
49 typedef void (*DrawBitmapProc)(SkCanvas*, const SkBitmap&,
50 const SkBitmap&, const SkPoint&,
51 SkTDArray<SkPixelRef*>* usedPixRefs);
52
53 #if 0
54 // Although specifiable, this case doesn't seem to make sense (i.e., the
55 // bitmap in the shader is never used).
56 static void drawsprite_withshader_proc(SkCanvas* canvas, const SkBitmap& bm,
57 const SkBitmap& altBM, const SkPoint& pos ,
58 SkTDArray<SkPixelRef*>* usedPixRefs) {
59 SkPaint paint;
60 init_paint(&paint, bm);
61
62 const SkMatrix& ctm = canvas->getTotalMatrix();
63
64 SkPoint p(pos);
65 ctm.mapPoints(&p, 1);
66
67 canvas->drawSprite(altBM, (int)p.fX, (int)p.fY, &paint);
68 *usedPixRefs->append() = bm.pixelRef();
69 *usedPixRefs->append() = altBM.pixelRef();
70 }
71 #endif
72
73 /* Hit a few SkPicture::Analysis cases not handled elsewhere. */ 49 /* Hit a few SkPicture::Analysis cases not handled elsewhere. */
74 static void test_analysis(skiatest::Reporter* reporter) { 50 static void test_analysis(skiatest::Reporter* reporter) {
75 SkPictureRecorder recorder; 51 SkPictureRecorder recorder;
76 52
77 SkCanvas* canvas = recorder.beginRecording(100, 100); 53 SkCanvas* canvas = recorder.beginRecording(100, 100);
78 { 54 {
79 canvas->drawRect(SkRect::MakeWH(10, 10), SkPaint ()); 55 canvas->drawRect(SkRect::MakeWH(10, 10), SkPaint ());
80 } 56 }
81 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 57 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
82 REPORTER_ASSERT(reporter, !picture->willPlayBackBitmaps()); 58 REPORTER_ASSERT(reporter, !picture->willPlayBackBitmaps());
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 1305
1330 // The picture shares the immutable pixels but copies the mutable ones. 1306 // The picture shares the immutable pixels but copies the mutable ones.
1331 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1307 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1332 REPORTER_ASSERT(r, !immut.pixelRef()->unique()); 1308 REPORTER_ASSERT(r, !immut.pixelRef()->unique());
1333 1309
1334 // When the picture goes away, it's just our bitmaps holding the refs. 1310 // When the picture goes away, it's just our bitmaps holding the refs.
1335 pic.reset(NULL); 1311 pic.reset(NULL);
1336 REPORTER_ASSERT(r, mut.pixelRef()->unique()); 1312 REPORTER_ASSERT(r, mut.pixelRef()->unique());
1337 REPORTER_ASSERT(r, immut.pixelRef()->unique()); 1313 REPORTER_ASSERT(r, immut.pixelRef()->unique());
1338 } 1314 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698