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

Side by Side Diff: samplecode/SampleCircle.cpp

Issue 163603003: add peekPixels to SkCanvas and SkSurface (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 | « samplecode/SampleApp.cpp ('k') | samplecode/SampleLayers.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 2011 Google Inc. 3 * Copyright 2011 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 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 for (int width = -1; width <= 1; width++) { 64 for (int width = -1; width <= 1; width++) {
65 canvas->save(); 65 canvas->save();
66 circle(canvas, width, false); 66 circle(canvas, width, false);
67 canvas->translate(0, dy); 67 canvas->translate(0, dy);
68 circle(canvas, width, true); 68 circle(canvas, width, true);
69 canvas->restore(); 69 canvas->restore();
70 canvas->translate(dx, 0); 70 canvas->translate(dx, 0);
71 } 71 }
72 } 72 }
73 73
74 static void blowup(SkCanvas* canvas, const SkIRect& src, const SkRect& dst) {
75 SkBaseDevice* device = canvas->getDevice();
76 const SkBitmap& bm = device->accessBitmap(false);
77 canvas->drawBitmapRect(bm, &src, dst, NULL);
78 }
79
80 static void make_poly(SkPath* path, int n) { 74 static void make_poly(SkPath* path, int n) {
81 if (n <= 0) { 75 if (n <= 0) {
82 return; 76 return;
83 } 77 }
84 path->incReserve(n + 1); 78 path->incReserve(n + 1);
85 path->moveTo(SK_Scalar1, 0); 79 path->moveTo(SK_Scalar1, 0);
86 SkScalar step = SK_ScalarPI * 2 / n; 80 SkScalar step = SK_ScalarPI * 2 / n;
87 SkScalar angle = 0; 81 SkScalar angle = 0;
88 for (int i = 1; i < n; i++) { 82 for (int i = 1; i < n; i++) {
89 angle += step; 83 angle += step;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 }; 118 };
125 119
126 const SkScalar CircleView::ANIM_DX(SK_Scalar1 / 67); 120 const SkScalar CircleView::ANIM_DX(SK_Scalar1 / 67);
127 const SkScalar CircleView::ANIM_DY(SK_Scalar1 / 29); 121 const SkScalar CircleView::ANIM_DY(SK_Scalar1 / 29);
128 const SkScalar CircleView::ANIM_RAD(SK_Scalar1 / 19); 122 const SkScalar CircleView::ANIM_RAD(SK_Scalar1 / 19);
129 123
130 ////////////////////////////////////////////////////////////////////////////// 124 //////////////////////////////////////////////////////////////////////////////
131 125
132 static SkView* MyFactory() { return new CircleView; } 126 static SkView* MyFactory() { return new CircleView; }
133 static SkViewRegister reg(MyFactory); 127 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | samplecode/SampleLayers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698