| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 #include "DecodeFile.h" | 7 #include "DecodeFile.h" |
| 9 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 10 #include "Resources.h" | 9 #include "Resources.h" |
| 11 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 63 } |
| 65 | 64 |
| 66 SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLight
Angle, | 65 SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLight
Angle, |
| 67 fColor
Factor)); | 66 fColor
Factor)); |
| 68 SkPaint paint; | 67 SkPaint paint; |
| 69 paint.setShader(SkLightingShader::Make(fDiffuseBitmap, fNormalBitmap, | 68 paint.setShader(SkLightingShader::Make(fDiffuseBitmap, fNormalBitmap, |
| 70 lights, SkVector::Make(1.0f, 0.0f
), | 69 lights, SkVector::Make(1.0f, 0.0f
), |
| 71 nullptr, nullptr)); | 70 nullptr, nullptr)); |
| 72 paint.setColor(SK_ColorBLACK); | 71 paint.setColor(SK_ColorBLACK); |
| 73 | 72 |
| 74 SkRect r = SkRect::MakeWH((SkScalar)fDiffuseBitmap.width(), | 73 SkRect r = SkRect::MakeWH((SkScalar)fDiffuseBitmap.width(), |
| 75 (SkScalar)fDiffuseBitmap.height()); | 74 (SkScalar)fDiffuseBitmap.height()); |
| 76 canvas->drawRect(r, paint); | 75 canvas->drawRect(r, paint); |
| 77 | 76 |
| 78 // so we're constantly updating | 77 // so we're constantly updating |
| 79 this->inval(nullptr); | 78 this->inval(nullptr); |
| 80 } | 79 } |
| 81 | 80 |
| 82 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { | 81 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) ove
rride { |
| 83 this->inval(nullptr); | 82 this->inval(nullptr); |
| 84 return this->INHERITED::onFindClickHandler(x, y, modi); | 83 return this->INHERITED::onFindClickHandler(x, y, modi); |
| 85 } | 84 } |
| 86 | 85 |
| 87 private: | 86 private: |
| 88 typedef SampleView INHERITED; | 87 typedef SampleView INHERITED; |
| 89 }; | 88 }; |
| 90 | 89 |
| 91 ////////////////////////////////////////////////////////////////////////////// | 90 ////////////////////////////////////////////////////////////////////////////// |
| 92 | 91 |
| 93 static SkView* MyFactory() { return new LightingView; } | 92 static SkView* MyFactory() { return new LightingView; } |
| 94 static SkViewRegister reg(MyFactory); | 93 static SkViewRegister reg(MyFactory); |
| OLD | NEW |