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

Side by Side Diff: samplecode/SampleQuadStroker.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « samplecode/SamplePolyToPoly.cpp ('k') | samplecode/SampleRectanizer.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 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "SampleCode.h" 9 #include "SampleCode.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 386 }
387 } 387 }
388 } 388 }
389 389
390 void draw_stroke(SkCanvas* canvas, const SkPath& path, SkScalar width, SkSca lar scale, 390 void draw_stroke(SkCanvas* canvas, const SkPath& path, SkScalar width, SkSca lar scale,
391 bool drawText) { 391 bool drawText) {
392 if (path.isEmpty()) { 392 if (path.isEmpty()) {
393 return; 393 return;
394 } 394 }
395 SkRect bounds = path.getBounds(); 395 SkRect bounds = path.getBounds();
396 this->setWHZ(SkScalarCeilToInt(bounds.right()), drawText 396 this->setWHZ(SkScalarCeilToInt(bounds.right()), drawText
397 ? SkScalarRoundToInt(scale * 3 / 2) : SkScalarRoundToInt(scale), 397 ? SkScalarRoundToInt(scale * 3 / 2) : SkScalarRoundToInt(scale),
398 SkScalarRoundToInt(950.0f / scale)); 398 SkScalarRoundToInt(950.0f / scale));
399 erase(fMinSurface); 399 erase(fMinSurface);
400 SkPaint paint; 400 SkPaint paint;
401 paint.setColor(0x1f1f0f0f); 401 paint.setColor(0x1f1f0f0f);
402 paint.setStyle(SkPaint::kStroke_Style); 402 paint.setStyle(SkPaint::kStroke_Style);
403 paint.setStrokeWidth(width * scale * scale); 403 paint.setStrokeWidth(width * scale * scale);
404 paint.setColor(0x3f0f1f3f); 404 paint.setColor(0x3f0f1f3f);
405 if (drawText) { 405 if (drawText) {
406 fMinSurface->getCanvas()->drawPath(path, paint); 406 fMinSurface->getCanvas()->drawPath(path, paint);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 path.addCircle(center.fX, center.fY, maxSide); 467 path.addCircle(center.fX, center.fY, maxSide);
468 canvas->drawPath(path, paint); 468 canvas->drawPath(path, paint);
469 paint.setStyle(SkPaint::kFill_Style); 469 paint.setStyle(SkPaint::kFill_Style);
470 path.reset(); 470 path.reset();
471 path.addCircle(center.fX, center.fY, maxSide - width / 2); 471 path.addCircle(center.fX, center.fY, maxSide - width / 2);
472 paint.setColor(0x3f0f1f3f); 472 paint.setColor(0x3f0f1f3f);
473 canvas->drawPath(path, paint); 473 canvas->drawPath(path, paint);
474 path.reset(); 474 path.reset();
475 path.setFillType(SkPath::kEvenOdd_FillType); 475 path.setFillType(SkPath::kEvenOdd_FillType);
476 path.addCircle(center.fX, center.fY, maxSide + width / 2); 476 path.addCircle(center.fX, center.fY, maxSide + width / 2);
477 SkRect outside = SkRect::MakeXYWH(center.fX - maxSide - width, center.fY - maxSide - width, 477 SkRect outside = SkRect::MakeXYWH(center.fX - maxSide - width, center.fY - maxSide - width,
478 (maxSide + width) * 2, (maxSide + width) * 2); 478 (maxSide + width) * 2, (maxSide + width) * 2);
479 path.addRect(outside); 479 path.addRect(outside);
480 canvas->drawPath(path, paint); 480 canvas->drawPath(path, paint);
481 } 481 }
482 482
483 void draw_button(SkCanvas* canvas, const StrokeTypeButton& button) { 483 void draw_button(SkCanvas* canvas, const StrokeTypeButton& button) {
484 SkPaint paint; 484 SkPaint paint;
485 paint.setAntiAlias(true); 485 paint.setAntiAlias(true);
486 paint.setStyle(SkPaint::kStroke_Style); 486 paint.setStyle(SkPaint::kStroke_Style);
487 paint.setColor(button.fEnabled ? 0xFF3F0000 : 0x6F3F0000); 487 paint.setColor(button.fEnabled ? 0xFF3F0000 : 0x6F3F0000);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 if (fCircleButton.fEnabled) { 641 if (fCircleButton.fEnabled) {
642 path.reset(); 642 path.reset();
643 SkRect r; 643 SkRect r;
644 r.set(&fPts[15], 2); 644 r.set(&fPts[15], 2);
645 path.addOval(r); 645 path.addOval(r);
646 setForGeometry(); 646 setForGeometry();
647 if (fCircleButton.fFill) { 647 if (fCircleButton.fFill) {
648 if (fArcButton.fEnabled) { 648 if (fArcButton.fEnabled) {
649 SkPoint center; 649 SkPoint center;
650 if (arcCenter(&center)) { 650 if (arcCenter(&center)) {
651 r.set(center.fX - fRadius, center.fY - fRadius, center.f X + fRadius, 651 r.set(center.fX - fRadius, center.fY - fRadius, center.f X + fRadius,
652 center.fY + fRadius); 652 center.fY + fRadius);
653 } 653 }
654 } 654 }
655 draw_fill(canvas, r, width); 655 draw_fill(canvas, r, width);
656 } else { 656 } else {
657 draw_stroke(canvas, path, width, 950, false); 657 draw_stroke(canvas, path, width, 950, false);
658 } 658 }
659 } 659 }
660 660
661 if (fTextButton.fEnabled) { 661 if (fTextButton.fEnabled) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 } 792 }
793 793
794 private: 794 private:
795 typedef SkView INHERITED; 795 typedef SkView INHERITED;
796 }; 796 };
797 797
798 /////////////////////////////////////////////////////////////////////////////// 798 ///////////////////////////////////////////////////////////////////////////////
799 799
800 static SkView* F2() { return new QuadStrokerView; } 800 static SkView* F2() { return new QuadStrokerView; }
801 static SkViewRegister gR2(F2); 801 static SkViewRegister gR2(F2);
OLDNEW
« no previous file with comments | « samplecode/SamplePolyToPoly.cpp ('k') | samplecode/SampleRectanizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698