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

Side by Side Diff: samplecode/SamplePicture.cpp

Issue 238273012: Staged removal of SkPicture-derived classes (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: have SkPicture only friend SkPictureRecorder once Created 6 years, 8 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 | « samplecode/SamplePictFile.cpp ('k') | samplecode/SampleTiling.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 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkDecodingImageGenerator.h" 10 #include "SkDecodingImageGenerator.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 class PictureView : public SampleView { 57 class PictureView : public SampleView {
58 SkBitmap fBitmap; 58 SkBitmap fBitmap;
59 public: 59 public:
60 PictureView() { 60 PictureView() {
61 61
62 fBitmap = load_bitmap(); 62 fBitmap = load_bitmap();
63 63
64 SkPictureRecorder recorder; 64 SkPictureRecorder recorder;
65 65
66 recorder.beginRecording(100, 100); 66 recorder.beginRecording(100, 100, NULL, 0);
67 fSubPicture = recorder.endRecording(); 67 fSubPicture = recorder.endRecording();
68 68
69 SkCanvas* canvas = recorder.beginRecording(100, 100); 69 SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
70 SkPaint paint; 70 SkPaint paint;
71 paint.setAntiAlias(true); 71 paint.setAntiAlias(true);
72 72
73 canvas->drawBitmap(fBitmap, 0, 0, NULL); 73 canvas->drawBitmap(fBitmap, 0, 0, NULL);
74 74
75 drawCircle(canvas, 50, SK_ColorBLACK); 75 drawCircle(canvas, 50, SK_ColorBLACK);
76 canvas->drawPicture(*fSubPicture); 76 canvas->drawPicture(*fSubPicture);
77 canvas->translate(SkIntToScalar(50), 0); 77 canvas->translate(SkIntToScalar(50), 0);
78 canvas->drawPicture(*fSubPicture); 78 canvas->drawPicture(*fSubPicture);
79 canvas->translate(0, SkIntToScalar(50)); 79 canvas->translate(0, SkIntToScalar(50));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 paint.setTextSize(SkIntToScalar(40)); 125 paint.setTextSize(SkIntToScalar(40));
126 canvas->drawText("Picture", 7, SkIntToScalar(50), SkIntToScalar(62), 126 canvas->drawText("Picture", 7, SkIntToScalar(50), SkIntToScalar(62),
127 paint); 127 paint);
128 128
129 } 129 }
130 130
131 virtual void onDrawContent(SkCanvas* canvas) { 131 virtual void onDrawContent(SkCanvas* canvas) {
132 this->drawSomething(canvas); 132 this->drawSomething(canvas);
133 133
134 SkPictureRecorder recorder; 134 SkPictureRecorder recorder;
135 this->drawSomething(recorder.beginRecording(100, 100)); 135 this->drawSomething(recorder.beginRecording(100, 100, NULL, 0));
136 SkAutoTUnref<SkPicture> pict(recorder.endRecording()); 136 SkAutoTUnref<SkPicture> pict(recorder.endRecording());
137 137
138 canvas->save(); 138 canvas->save();
139 canvas->translate(SkIntToScalar(300), SkIntToScalar(50)); 139 canvas->translate(SkIntToScalar(300), SkIntToScalar(50));
140 canvas->scale(-SK_Scalar1, -SK_Scalar1); 140 canvas->scale(-SK_Scalar1, -SK_Scalar1);
141 canvas->translate(-SkIntToScalar(100), -SkIntToScalar(50)); 141 canvas->translate(-SkIntToScalar(100), -SkIntToScalar(50));
142 canvas->drawPicture(*pict); 142 canvas->drawPicture(*pict);
143 canvas->restore(); 143 canvas->restore();
144 144
145 canvas->save(); 145 canvas->save();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 SkPicture* fPicture; 191 SkPicture* fPicture;
192 SkPicture* fSubPicture; 192 SkPicture* fSubPicture;
193 193
194 typedef SampleView INHERITED; 194 typedef SampleView INHERITED;
195 }; 195 };
196 196
197 ////////////////////////////////////////////////////////////////////////////// 197 //////////////////////////////////////////////////////////////////////////////
198 198
199 static SkView* MyFactory() { return new PictureView; } 199 static SkView* MyFactory() { return new PictureView; }
200 static SkViewRegister reg(MyFactory); 200 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SamplePictFile.cpp ('k') | samplecode/SampleTiling.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698