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

Side by Side Diff: samplecode/SampleFatBits.cpp

Issue 1300513002: increase zoom in fatbits (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 "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 23 matching lines...) Expand all
34 34
35 static void erase(SkSurface* surface) { 35 static void erase(SkSurface* surface) {
36 surface->getCanvas()->clear(SK_ColorTRANSPARENT); 36 surface->getCanvas()->clear(SK_ColorTRANSPARENT);
37 } 37 }
38 38
39 class FatBits { 39 class FatBits {
40 public: 40 public:
41 FatBits() { 41 FatBits() {
42 fAA = false; 42 fAA = false;
43 fStyle = kHair_Style; 43 fStyle = kHair_Style;
44 fGrid = true; 44 fGrid = false;
45 fShowSkeleton = true; 45 fShowSkeleton = true;
46 fUseGPU = false; 46 fUseGPU = false;
47 fUseClip = false; 47 fUseClip = false;
48 fRectAsOval = false; 48 fRectAsOval = false;
49 fUseTriangle = false; 49 fUseTriangle = false;
50 50
51 fClipRect.set(2, 2, 11, 8 ); 51 fClipRect.set(2, 2, 11, 8 );
52 } 52 }
53 53
54 int getZoom() const { return fZoom; } 54 int getZoom() const { return fZoom; }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 int fIndex; 369 int fIndex;
370 public: 370 public:
371 IndexClick(SkView* v, int index) : SkView::Click(v), fIndex(index) {} 371 IndexClick(SkView* v, int index) : SkView::Click(v), fIndex(index) {}
372 372
373 static int GetIndex(SkView::Click* click) { 373 static int GetIndex(SkView::Click* click) {
374 return ((IndexClick*)click)->fIndex; 374 return ((IndexClick*)click)->fIndex;
375 } 375 }
376 }; 376 };
377 377
378 class DrawLineView : public SampleView { 378 class DrawLineView : public SampleView {
379 enum {
380 kZoom = 96
381 };
382
379 FatBits fFB; 383 FatBits fFB;
380 SkPoint fPts[3]; 384 SkPoint fPts[3];
381 bool fIsRect; 385 bool fIsRect;
382 public: 386 public:
383 DrawLineView() { 387 DrawLineView() {
384 fFB.setWHZ(24, 16, 48); 388 fFB.setWHZ(24, 16, kZoom);
385 fPts[0].set(48, 48); 389 fPts[0].set(1, 1);
386 fPts[1].set(48 * 5, 48 * 4); 390 fPts[1].set(5, 4);
387 fPts[2].set(48 * 2, 48 * 6); 391 fPts[2].set(2, 6);
392 SkMatrix::MakeScale(kZoom, kZoom).mapPoints(fPts, 3);
388 fIsRect = false; 393 fIsRect = false;
389 } 394 }
390 395
391 void setStyle(FatBits::Style s) { 396 void setStyle(FatBits::Style s) {
392 fFB.setStyle(s); 397 fFB.setStyle(s);
393 this->inval(NULL); 398 this->inval(NULL);
394 } 399 }
395 400
396 protected: 401 protected:
397 bool onQuery(SkEvent* evt) override { 402 bool onQuery(SkEvent* evt) override {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 510
506 private: 511 private:
507 512
508 typedef SampleView INHERITED; 513 typedef SampleView INHERITED;
509 }; 514 };
510 515
511 ////////////////////////////////////////////////////////////////////////////// 516 //////////////////////////////////////////////////////////////////////////////
512 517
513 static SkView* MyFactory() { return new DrawLineView; } 518 static SkView* MyFactory() { return new DrawLineView; }
514 static SkViewRegister reg(MyFactory); 519 static SkViewRegister reg(MyFactory);
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