| 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 "gm.h" | 8 #include "gm.h" |
| 9 #include "sk_tool_utils.h" | 9 #include "sk_tool_utils.h" |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 paint.setAntiAlias(true); | 124 paint.setAntiAlias(true); |
| 125 paint.setColor(SK_ColorBLUE); | 125 paint.setColor(SK_ColorBLUE); |
| 126 paint.setStyle(SkPaint::kStroke_Style); | 126 paint.setStyle(SkPaint::kStroke_Style); |
| 127 paint.setStrokeWidth(20); | 127 paint.setStrokeWidth(20); |
| 128 | 128 |
| 129 canvas.drawCircle(50, 50, 39, paint); | 129 canvas.drawCircle(50, 50, 39, paint); |
| 130 canvas.flush(); | 130 canvas.flush(); |
| 131 | 131 |
| 132 fBitmap.extractAlpha(&fAlpha); | 132 fBitmap.extractAlpha(&fAlpha); |
| 133 } | 133 } |
| 134 | 134 |
| 135 public: | 135 public: |
| 136 SkBitmap fBitmap, fAlpha; | 136 SkBitmap fBitmap, fAlpha; |
| 137 | 137 |
| 138 protected: | 138 protected: |
| 139 SkString onShortName() override { | 139 SkString onShortName() override { |
| 140 return SkString("extractalpha"); | 140 return SkString("extractalpha"); |
| 141 } | 141 } |
| 142 | 142 |
| 143 SkISize onISize() override { | 143 SkISize onISize() override { |
| 144 return SkISize::Make(540, 330); | 144 return SkISize::Make(540, 330); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void onDraw(SkCanvas* canvas) override { | 147 void onDraw(SkCanvas* canvas) override { |
| 148 SkPaint paint; | 148 SkPaint paint; |
| 149 paint.setAntiAlias(true); | 149 paint.setAntiAlias(true); |
| 150 paint.setFilterQuality(kLow_SkFilterQuality); | 150 paint.setFilterQuality(kLow_SkFilterQuality); |
| 151 paint.setColor(SK_ColorRED); | 151 paint.setColor(SK_ColorRED); |
| 152 | 152 |
| 153 canvas->drawBitmap(fBitmap, 10, 10, &paint); // should stay blue (ign
ore paint's color) | 153 canvas->drawBitmap(fBitmap, 10, 10, &paint); // should stay blue (ign
ore paint's color) |
| 154 canvas->drawBitmap(fAlpha, 120, 10, &paint); // should draw red | 154 canvas->drawBitmap(fAlpha, 120, 10, &paint); // should draw red |
| 155 } | 155 } |
| 156 | 156 |
| 157 private: | 157 private: |
| 158 typedef skiagm::GM INHERITED; | 158 typedef skiagm::GM INHERITED; |
| 159 }; | 159 }; |
| 160 DEF_GM( return new TestExtractAlphaGM; ) | 160 DEF_GM( return new TestExtractAlphaGM; ) |
| 161 | |
| OLD | NEW |