| 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 void onDraw(SkCanvas* canvas) override { | 147 void onDraw(SkCanvas* canvas) override { |
| 148 SkRect dstRect = { 0, 0, SkIntToScalar(64), SkIntToScalar(64)}; | 148 SkRect dstRect = { 0, 0, SkIntToScalar(64), SkIntToScalar(64)}; |
| 149 static const int kMaxSrcRectSize = 1 << (SkNextLog2(gBmpSize) + 2); | 149 static const int kMaxSrcRectSize = 1 << (SkNextLog2(gBmpSize) + 2); |
| 150 | 150 |
| 151 static const int kPadX = 30; | 151 static const int kPadX = 30; |
| 152 static const int kPadY = 40; | 152 static const int kPadY = 40; |
| 153 SkPaint paint; | 153 SkPaint paint; |
| 154 paint.setAlpha(0x20); | 154 paint.setAlpha(0x20); |
| 155 canvas->drawBitmapRect(fLargeBitmap, NULL, | 155 canvas->drawBitmapRect(fLargeBitmap, SkRect::MakeIWH(gSize, gSize), &pai
nt); |
| 156 SkRect::MakeWH(gSize * SK_Scalar1, | |
| 157 gSize * SK_Scalar1), | |
| 158 &paint); | |
| 159 canvas->translate(SK_Scalar1 * kPadX / 2, | 156 canvas->translate(SK_Scalar1 * kPadX / 2, |
| 160 SK_Scalar1 * kPadY / 2); | 157 SK_Scalar1 * kPadY / 2); |
| 161 SkPaint blackPaint; | 158 SkPaint blackPaint; |
| 162 SkScalar titleHeight = SK_Scalar1 * 24; | 159 SkScalar titleHeight = SK_Scalar1 * 24; |
| 163 blackPaint.setColor(SK_ColorBLACK); | 160 blackPaint.setColor(SK_ColorBLACK); |
| 164 blackPaint.setTextSize(titleHeight); | 161 blackPaint.setTextSize(titleHeight); |
| 165 blackPaint.setAntiAlias(true); | 162 blackPaint.setAntiAlias(true); |
| 166 sk_tool_utils::set_portable_typeface(&blackPaint); | 163 sk_tool_utils::set_portable_typeface(&blackPaint); |
| 167 SkString title; | 164 SkString title; |
| 168 title.printf("Bitmap size: %d x %d", gBmpSize, gBmpSize); | 165 title.printf("Bitmap size: %d x %d", gBmpSize, gBmpSize); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 222 } |
| 226 } | 223 } |
| 227 | 224 |
| 228 private: | 225 private: |
| 229 typedef skiagm::GM INHERITED; | 226 typedef skiagm::GM INHERITED; |
| 230 }; | 227 }; |
| 231 | 228 |
| 232 DEF_GM( return new DrawBitmapRectGM(canvasproc, NULL); ) | 229 DEF_GM( return new DrawBitmapRectGM(canvasproc, NULL); ) |
| 233 DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) | 230 DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) |
| 234 DEF_GM( return new DrawBitmapRectGM(imagescaleproc, "-imagescale"); ) | 231 DEF_GM( return new DrawBitmapRectGM(imagescaleproc, "-imagescale"); ) |
| OLD | NEW |