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 "Checkerboard.h" | 8 #include "sk_tool_utils.h" |
9 #include "SampleCode.h" | 9 #include "SampleCode.h" |
10 #include "SkView.h" | 10 #include "SkView.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkPath.h" | 12 #include "SkPath.h" |
13 #include "SkRegion.h" | 13 #include "SkRegion.h" |
14 #include "SkShader.h" | 14 #include "SkShader.h" |
15 #include "SkUtils.h" | 15 #include "SkUtils.h" |
16 #include "SkImage.h" | 16 #include "SkImage.h" |
17 #include "SkSurface.h" | 17 #include "SkSurface.h" |
18 | 18 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 Style getStyle() const { return fStyle; } | 80 Style getStyle() const { return fStyle; } |
81 void setStyle(Style s) { fStyle = s; } | 81 void setStyle(Style s) { fStyle = s; } |
82 | 82 |
83 void setWHZ(int width, int height, int zoom) { | 83 void setWHZ(int width, int height, int zoom) { |
84 fW = width; | 84 fW = width; |
85 fH = height; | 85 fH = height; |
86 fZoom = zoom; | 86 fZoom = zoom; |
87 fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zo
om)); | 87 fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zo
om)); |
88 fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); | 88 fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom)); |
89 fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); | 89 fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom); |
90 fShader.reset(sk_tools::CreateCheckerboardShader( | 90 fShader.reset(sk_tool_utils::create_checkerboard_shader( |
91 0xFFCCCCCC, 0xFFFFFFFF, zoom)); | 91 0xFFCCCCCC, 0xFFFFFFFF, zoom)); |
92 | 92 |
93 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); | 93 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
94 fMinSurface.reset(SkSurface::NewRaster(info)); | 94 fMinSurface.reset(SkSurface::NewRaster(info)); |
95 info = info.makeWH(width * zoom, height * zoom); | 95 info = info.makeWH(width * zoom, height * zoom); |
96 fMaxSurface.reset(SkSurface::NewRaster(info)); | 96 fMaxSurface.reset(SkSurface::NewRaster(info)); |
97 } | 97 } |
98 | 98 |
99 void drawBG(SkCanvas*); | 99 void drawBG(SkCanvas*); |
100 void drawFG(SkCanvas*); | 100 void drawFG(SkCanvas*); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 506 |
507 private: | 507 private: |
508 | 508 |
509 typedef SampleView INHERITED; | 509 typedef SampleView INHERITED; |
510 }; | 510 }; |
511 | 511 |
512 ////////////////////////////////////////////////////////////////////////////// | 512 ////////////////////////////////////////////////////////////////////////////// |
513 | 513 |
514 static SkView* MyFactory() { return new DrawLineView; } | 514 static SkView* MyFactory() { return new DrawLineView; } |
515 static SkViewRegister reg(MyFactory); | 515 static SkViewRegister reg(MyFactory); |
OLD | NEW |