| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2011 Google Inc. | 2  * Copyright 2011 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 "DecodeFile.h" | 
| 8 #include "SampleCode.h" | 9 #include "SampleCode.h" | 
| 9 #include "SkView.h" | 10 #include "SkView.h" | 
| 10 #include "SkCanvas.h" | 11 #include "SkCanvas.h" | 
| 11 #include "SkCornerPathEffect.h" | 12 #include "SkCornerPathEffect.h" | 
| 12 #include "SkGradientShader.h" | 13 #include "SkGradientShader.h" | 
| 13 #include "SkGraphics.h" | 14 #include "SkGraphics.h" | 
| 14 #include "SkImageDecoder.h" |  | 
| 15 #include "SkPath.h" | 15 #include "SkPath.h" | 
| 16 #include "SkRandom.h" | 16 #include "SkRandom.h" | 
| 17 #include "SkRegion.h" | 17 #include "SkRegion.h" | 
| 18 #include "SkShader.h" | 18 #include "SkShader.h" | 
| 19 #include "SkUtils.h" | 19 #include "SkUtils.h" | 
| 20 #include "SkColorPriv.h" | 20 #include "SkColorPriv.h" | 
| 21 #include "SkColorFilter.h" | 21 #include "SkColorFilter.h" | 
| 22 #include "SkTime.h" | 22 #include "SkTime.h" | 
| 23 #include "SkTypeface.h" | 23 #include "SkTypeface.h" | 
| 24 #include "SkXfermode.h" | 24 #include "SkXfermode.h" | 
| 25 | 25 | 
| 26 #include "SkStream.h" | 26 #include "SkStream.h" | 
| 27 #include "SkColorPriv.h" | 27 #include "SkColorPriv.h" | 
| 28 #include "SkImageDecoder.h" |  | 
| 29 | 28 | 
| 30 class LinesView : public SampleView { | 29 class LinesView : public SampleView { | 
| 31 public: | 30 public: | 
| 32     LinesView() {} | 31     LinesView() {} | 
| 33 | 32 | 
| 34 protected: | 33 protected: | 
| 35     // overrides from SkEventSink | 34     // overrides from SkEventSink | 
| 36     bool onQuery(SkEvent* evt) override { | 35     bool onQuery(SkEvent* evt) override { | 
| 37         if (SampleCode::TitleQ(*evt)) { | 36         if (SampleCode::TitleQ(*evt)) { | 
| 38             SampleCode::TitleR(evt, "Lines"); | 37             SampleCode::TitleR(evt, "Lines"); | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 56      //   paint.setAntiAlias(true); | 55      //   paint.setAntiAlias(true); | 
| 57         paint.setStyle(SkPaint::kStroke_Style); | 56         paint.setStyle(SkPaint::kStroke_Style); | 
| 58         paint.setStrokeWidth(SkScalarHalf(SkIntToScalar(3))); | 57         paint.setStrokeWidth(SkScalarHalf(SkIntToScalar(3))); | 
| 59         paint.setColor(0xFFFF8800); | 58         paint.setColor(0xFFFF8800); | 
| 60      //   paint.setColor(0xFFFFFFFF); | 59      //   paint.setColor(0xFFFFFFFF); | 
| 61         canvas->drawRect(r, paint); | 60         canvas->drawRect(r, paint); | 
| 62     } | 61     } | 
| 63 | 62 | 
| 64     void onDrawContent(SkCanvas* canvas) override { | 63     void onDrawContent(SkCanvas* canvas) override { | 
| 65         SkBitmap bm; | 64         SkBitmap bm; | 
| 66         SkImageDecoder::DecodeFile("/kill.gif", &bm); | 65         decode_file("/kill.gif", &bm); | 
| 67         canvas->drawBitmap(bm, 0, 0, nullptr); | 66         canvas->drawBitmap(bm, 0, 0, nullptr); | 
| 68 | 67 | 
| 69         this->drawRings(canvas); | 68         this->drawRings(canvas); | 
| 70         return; | 69         return; | 
| 71 | 70 | 
| 72         SkPaint paint; | 71         SkPaint paint; | 
| 73 | 72 | 
| 74       //  fAlpha = 0x80; | 73       //  fAlpha = 0x80; | 
| 75         paint.setColor(SK_ColorWHITE); | 74         paint.setColor(SK_ColorWHITE); | 
| 76         paint.setAlpha(fAlpha & 0xFF); | 75         paint.setAlpha(fAlpha & 0xFF); | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 103 private: | 102 private: | 
| 104 | 103 | 
| 105     int fAlpha; | 104     int fAlpha; | 
| 106     typedef SampleView INHERITED; | 105     typedef SampleView INHERITED; | 
| 107 }; | 106 }; | 
| 108 | 107 | 
| 109 ////////////////////////////////////////////////////////////////////////////// | 108 ////////////////////////////////////////////////////////////////////////////// | 
| 110 | 109 | 
| 111 static SkView* MyFactory() { return new LinesView; } | 110 static SkView* MyFactory() { return new LinesView; } | 
| 112 static SkViewRegister reg(MyFactory); | 111 static SkViewRegister reg(MyFactory); | 
| OLD | NEW | 
|---|