| 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" |
| 11 | 11 |
| 12 static const int kILimit = 101; | 12 static const int kILimit = 101; |
| 13 static const SkScalar kLimit = SK_Scalar1 * kILimit; | 13 static const SkScalar kLimit = SK_Scalar1 * kILimit; |
| 14 | 14 |
| 15 class OvalTestView : public SampleView { | 15 class OvalTestView : public SampleView { |
| 16 public: | 16 public: |
| 17 SkSize fSize; | 17 SkSize fSize; |
| 18 SkPMColor fInsideColor; // signals an interior pixel that was not set | 18 SkPMColor fInsideColor; // signals an interior pixel that was not set |
| 19 SkPMColor fOutsideColor; // signals an exterior pixels that was set | 19 SkPMColor fOutsideColor; // signals an exterior pixels that was set |
| 20 SkBitmap fBitmap; | 20 SkBitmap fBitmap; |
| 21 | 21 |
| 22 OvalTestView() { | 22 OvalTestView() { |
| 23 fSize.set(SK_Scalar1, SK_Scalar1); | 23 fSize.set(SK_Scalar1, SK_Scalar1); |
| 24 | 24 |
| 25 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, kILimit, kILimit); | 25 fBitmap.allocN32Pixels(kILimit, kILimit); |
| 26 fBitmap.allocPixels(); | |
| 27 | 26 |
| 28 fInsideColor = SkPreMultiplyColor(SK_ColorRED); | 27 fInsideColor = SkPreMultiplyColor(SK_ColorRED); |
| 29 fOutsideColor = SkPreMultiplyColor(SK_ColorGREEN); | 28 fOutsideColor = SkPreMultiplyColor(SK_ColorGREEN); |
| 30 | 29 |
| 31 this->setBGColor(0xFFDDDDDD); | 30 this->setBGColor(0xFFDDDDDD); |
| 32 } | 31 } |
| 33 | 32 |
| 34 protected: | 33 protected: |
| 35 // overrides from SkEventSink | 34 // overrides from SkEventSink |
| 36 virtual bool onQuery(SkEvent* evt) { | 35 virtual bool onQuery(SkEvent* evt) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 106 } |
| 108 | 107 |
| 109 private: | 108 private: |
| 110 typedef SampleView INHERITED; | 109 typedef SampleView INHERITED; |
| 111 }; | 110 }; |
| 112 | 111 |
| 113 /////////////////////////////////////////////////////////////////////////////// | 112 /////////////////////////////////////////////////////////////////////////////// |
| 114 | 113 |
| 115 static SkView* MyFactory() { return new OvalTestView; } | 114 static SkView* MyFactory() { return new OvalTestView; } |
| 116 static SkViewRegister reg(MyFactory); | 115 static SkViewRegister reg(MyFactory); |
| OLD | NEW |