OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 MipMapView() { | 45 MipMapView() { |
46 fOnce = false; | 46 fOnce = false; |
47 } | 47 } |
48 | 48 |
49 void init() { | 49 void init() { |
50 if (fOnce) { | 50 if (fOnce) { |
51 return; | 51 return; |
52 } | 52 } |
53 fOnce = true; | 53 fOnce = true; |
54 | 54 |
55 fBitmap = createBitmap(N); | 55 fBitmap = createBitmap(N*5); |
56 | 56 |
57 fWidth = N; | 57 fWidth = N; |
58 } | 58 } |
59 | 59 |
60 protected: | 60 protected: |
61 // overrides from SkEventSink | 61 // overrides from SkEventSink |
62 virtual bool onQuery(SkEvent* evt) { | 62 virtual bool onQuery(SkEvent* evt) { |
63 if (SampleCode::TitleQ(*evt)) { | 63 if (SampleCode::TitleQ(*evt)) { |
64 SampleCode::TitleR(evt, "MipMaps"); | 64 SampleCode::TitleR(evt, "MipMaps"); |
65 return true; | 65 return true; |
(...skipping 14 matching lines...) Expand all Loading... |
80 SkPaint paint; | 80 SkPaint paint; |
81 | 81 |
82 for (size_t i = 0; i < SK_ARRAY_COUNT(gLevel); ++i) { | 82 for (size_t i = 0; i < SK_ARRAY_COUNT(gLevel); ++i) { |
83 SkScalar x = 10.0f + i * 100; | 83 SkScalar x = 10.0f + i * 100; |
84 SkScalar y = 10.0f; | 84 SkScalar y = 10.0f; |
85 | 85 |
86 paint.setFilterLevel(gLevel[i]); | 86 paint.setFilterLevel(gLevel[i]); |
87 | 87 |
88 canvas->drawBitmap(fBitmap, x, y, &paint); | 88 canvas->drawBitmap(fBitmap, x, y, &paint); |
89 } | 89 } |
90 this->inval(NULL); | 90 // this->inval(NULL); |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 int fWidth; | 94 int fWidth; |
95 | 95 |
96 typedef SampleView INHERITED; | 96 typedef SampleView INHERITED; |
97 }; | 97 }; |
98 | 98 |
99 ////////////////////////////////////////////////////////////////////////////// | 99 ////////////////////////////////////////////////////////////////////////////// |
100 | 100 |
101 static SkView* MyFactory() { return new MipMapView; } | 101 static SkView* MyFactory() { return new MipMapView; } |
102 static SkViewRegister reg(MyFactory); | 102 static SkViewRegister reg(MyFactory); |
OLD | NEW |