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/CanvasTest.cpp

Issue 136753016: remove (unused by chrome) SkDeferredCanvas(device) factory signature (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « src/utils/SkDeferredCanvas.cpp ('k') | tests/DeferredCanvasTest.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 /* 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 /* Description: 9 /* Description:
10 * This test defines a series of elementatry test steps that perform 10 * This test defines a series of elementatry test steps that perform
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "SkPDFDocument.h" 54 #include "SkPDFDocument.h"
55 #include "SkPaint.h" 55 #include "SkPaint.h"
56 #include "SkPath.h" 56 #include "SkPath.h"
57 #include "SkPicture.h" 57 #include "SkPicture.h"
58 #include "SkPictureRecord.h" 58 #include "SkPictureRecord.h"
59 #include "SkProxyCanvas.h" 59 #include "SkProxyCanvas.h"
60 #include "SkRect.h" 60 #include "SkRect.h"
61 #include "SkRegion.h" 61 #include "SkRegion.h"
62 #include "SkShader.h" 62 #include "SkShader.h"
63 #include "SkStream.h" 63 #include "SkStream.h"
64 #include "SkSurface.h"
64 #include "SkTDArray.h" 65 #include "SkTDArray.h"
65 #include "Test.h" 66 #include "Test.h"
66 67
67 class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { 68 class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor {
68 public: 69 public:
69 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {} 70 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {}
70 71
71 virtual void clipRect(const SkRect& r, SkRegion::Op op, bool aa) { 72 virtual void clipRect(const SkRect& r, SkRegion::Op op, bool aa) {
72 fTarget->clipRect(r, op, aa); 73 fTarget->clipRect(r, op, aa);
73 } 74 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 "test step %s, SkNWayCanvas indirect canvas 2 state consistency"; 134 "test step %s, SkNWayCanvas indirect canvas 2 state consistency";
134 static const char* const kPdfAssertMessageFormat = 135 static const char* const kPdfAssertMessageFormat =
135 "PDF sanity check failed %s"; 136 "PDF sanity check failed %s";
136 137
137 static void createBitmap(SkBitmap* bm, SkBitmap::Config config, SkColor color) { 138 static void createBitmap(SkBitmap* bm, SkBitmap::Config config, SkColor color) {
138 bm->setConfig(config, kWidth, kHeight); 139 bm->setConfig(config, kWidth, kHeight);
139 bm->allocPixels(); 140 bm->allocPixels();
140 bm->eraseColor(color); 141 bm->eraseColor(color);
141 } 142 }
142 143
144 static SkSurface* createSurface(SkColor color) {
145 SkSurface* surface = SkSurface::NewRasterPMColor(kWidth, kHeight);
146 surface->getCanvas()->clear(color);
147 return surface;
148 }
149
143 class CanvasTestStep; 150 class CanvasTestStep;
144 static SkTDArray<CanvasTestStep*>& testStepArray() { 151 static SkTDArray<CanvasTestStep*>& testStepArray() {
145 static SkTDArray<CanvasTestStep*> theTests; 152 static SkTDArray<CanvasTestStep*> theTests;
146 return theTests; 153 return theTests;
147 } 154 }
148 155
149 class CanvasTestStep { 156 class CanvasTestStep {
150 public: 157 public:
151 CanvasTestStep(bool fEnablePdfTesting = true) { 158 CanvasTestStep(bool fEnablePdfTesting = true) {
152 *testStepArray().append() = this; 159 *testStepArray().append() = this;
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 749
743 // The following class groups static functions that need to access 750 // The following class groups static functions that need to access
744 // the privates members of SkDeferredCanvas 751 // the privates members of SkDeferredCanvas
745 class SkDeferredCanvasTester { 752 class SkDeferredCanvasTester {
746 public: 753 public:
747 static void TestDeferredCanvasStateConsistency( 754 static void TestDeferredCanvasStateConsistency(
748 skiatest::Reporter* reporter, 755 skiatest::Reporter* reporter,
749 CanvasTestStep* testStep, 756 CanvasTestStep* testStep,
750 const SkCanvas& referenceCanvas, bool silent) { 757 const SkCanvas& referenceCanvas, bool silent) {
751 758
752 SkBitmap deferredStore; 759 SkAutoTUnref<SkSurface> surface(createSurface(0xFFFFFFFF));
753 createBitmap(&deferredStore, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); 760 SkAutoTUnref<SkDeferredCanvas> deferredCanvas(SkDeferredCanvas::Create(s urface.get()));
754 SkBitmapDevice deferredDevice(deferredStore); 761
755 SkAutoTUnref<SkDeferredCanvas> deferredCanvas(SkDeferredCanvas::Create(& deferredDevice));
756 testStep->setAssertMessageFormat(kDeferredDrawAssertMessageFormat); 762 testStep->setAssertMessageFormat(kDeferredDrawAssertMessageFormat);
757 testStep->draw(deferredCanvas, reporter); 763 testStep->draw(deferredCanvas, reporter);
758 testStep->setAssertMessageFormat(kDeferredPreFlushAssertMessageFormat); 764 testStep->setAssertMessageFormat(kDeferredPreFlushAssertMessageFormat);
759 AssertCanvasStatesEqual(reporter, deferredCanvas, &referenceCanvas, 765 AssertCanvasStatesEqual(reporter, deferredCanvas, &referenceCanvas,
760 testStep); 766 testStep);
761 767
762 if (silent) { 768 if (silent) {
763 deferredCanvas->silentFlush(); 769 deferredCanvas->silentFlush();
764 } else { 770 } else {
765 deferredCanvas->flush(); 771 deferredCanvas->flush();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 SkPictureTester::TestPictureFlattenedObjectReuse(reporter, 901 SkPictureTester::TestPictureFlattenedObjectReuse(reporter,
896 testStepArray()[testStep], 0); 902 testStepArray()[testStep], 0);
897 if (testStepArray()[testStep]->enablePdfTesting()) { 903 if (testStepArray()[testStep]->enablePdfTesting()) {
898 TestPdfDevice(reporter, testStepArray()[testStep]); 904 TestPdfDevice(reporter, testStepArray()[testStep]);
899 } 905 }
900 } 906 }
901 907
902 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i s a global) 908 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i s a global)
903 kTestBitmap.reset(); 909 kTestBitmap.reset();
904 } 910 }
OLDNEW
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698