| OLD | NEW |
| 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 "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 fW = width; | 95 fW = width; |
| 96 fH = height; | 96 fH = height; |
| 97 fZoom = zoom; | 97 fZoom = zoom; |
| 98 fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zo
om)); | 98 fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zo
om)); |
| 99 fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); | 99 fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); |
| 100 fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); | 100 fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); |
| 101 fShader.reset(createChecker(fMatrix)); | 101 fShader.reset(createChecker(fMatrix)); |
| 102 | 102 |
| 103 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); | 103 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
| 104 fMinSurface.reset(SkSurface::NewRaster(info)); | 104 fMinSurface.reset(SkSurface::NewRaster(info)); |
| 105 info.fWidth *= zoom; | 105 info = info.makeWH(width * zoom, height * zoom); |
| 106 info.fHeight *= zoom; | |
| 107 fMaxSurface.reset(SkSurface::NewRaster(info)); | 106 fMaxSurface.reset(SkSurface::NewRaster(info)); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void drawBG(SkCanvas*); | 109 void drawBG(SkCanvas*); |
| 111 void drawFG(SkCanvas*); | 110 void drawFG(SkCanvas*); |
| 112 void drawLine(SkCanvas*, SkPoint pts[2]); | 111 void drawLine(SkCanvas*, SkPoint pts[2]); |
| 113 void drawRect(SkCanvas* canvas, SkPoint pts[2]); | 112 void drawRect(SkCanvas* canvas, SkPoint pts[2]); |
| 114 void drawTriangle(SkCanvas* canvas, SkPoint pts[3]); | 113 void drawTriangle(SkCanvas* canvas, SkPoint pts[3]); |
| 115 | 114 |
| 116 private: | 115 private: |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 516 |
| 518 private: | 517 private: |
| 519 | 518 |
| 520 typedef SampleView INHERITED; | 519 typedef SampleView INHERITED; |
| 521 }; | 520 }; |
| 522 | 521 |
| 523 ////////////////////////////////////////////////////////////////////////////// | 522 ////////////////////////////////////////////////////////////////////////////// |
| 524 | 523 |
| 525 static SkView* MyFactory() { return new DrawLineView; } | 524 static SkView* MyFactory() { return new DrawLineView; } |
| 526 static SkViewRegister reg(MyFactory); | 525 static SkViewRegister reg(MyFactory); |
| OLD | NEW |