| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "gm.h" |
| robertphillips@google.com | b706117 | 2013-09-06 14:16:12 +0000 | [diff] [blame] | 9 | #include "SkBlurMask.h" |
| robertphillips@google.com | 2cc0b47 | 2013-08-20 16:51:20 +0000 | [diff] [blame] | 10 | #include "SkBlurMaskFilter.h" |
| robertphillips@google.com | b706117 | 2013-09-06 14:16:12 +0000 | [diff] [blame] | 11 | #include "SkCanvas.h" |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 12 | |
| 13 | #if SK_SUPPORT_GPU |
| 14 | #include "GrContext.h" |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 15 | #endif |
| 16 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 17 | // Create a black&white checked texture with 2 1-pixel rings |
| 18 | // around the outside edge. The inner ring is red and the outer ring is blue. |
| 19 | static void make_ringed_bitmap(SkBitmap* result, int width, int height) { |
| 20 | SkASSERT(0 == width % 2 && 0 == height % 2); |
| 21 | |
| 22 | static const SkPMColor kRed = SkPreMultiplyColor(SK_ColorRED); |
| 23 | static const SkPMColor kBlue = SkPreMultiplyColor(SK_ColorBLUE); |
| 24 | static const SkPMColor kBlack = SkPreMultiplyColor(SK_ColorBLACK); |
| 25 | static const SkPMColor kWhite = SkPreMultiplyColor(SK_ColorWHITE); |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 26 | |
| reed@google.com | 383a697 | 2013-10-21 14:00:07 +0000 | [diff] [blame] | 27 | result->setConfig(SkBitmap::kARGB_8888_Config, width, height, 0, |
| 28 | kOpaque_SkAlphaType); |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 29 | result->allocPixels(); |
| 30 | SkAutoLockPixels lock(*result); |
| 31 | |
| skia.committer@gmail.com | 956b310 | 2013-07-26 07:00:58 +0000 | [diff] [blame] | 32 | SkPMColor* scanline = result->getAddr32(0, 0); |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 33 | for (int x = 0; x < width; ++x) { |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 34 | scanline[x] = kBlue; |
| 35 | } |
| 36 | scanline = result->getAddr32(0, 1); |
| 37 | scanline[0] = kBlue; |
| 38 | for (int x = 1; x < width - 1; ++x) { |
| 39 | scanline[x] = kRed; |
| 40 | } |
| 41 | scanline[width-1] = kBlue; |
| 42 | |
| 43 | for (int y = 2; y < height/2; ++y) { |
| 44 | scanline = result->getAddr32(0, y); |
| 45 | scanline[0] = kBlue; |
| 46 | scanline[1] = kRed; |
| 47 | for (int x = 2; x < width/2; ++x) { |
| 48 | scanline[x] = kBlack; |
| 49 | } |
| 50 | for (int x = width/2; x < width-2; ++x) { |
| 51 | scanline[x] = kWhite; |
| 52 | } |
| 53 | scanline[width-2] = kRed; |
| 54 | scanline[width-1] = kBlue; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 57 | for (int y = height/2; y < height-2; ++y) { |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 58 | scanline = result->getAddr32(0, y); |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 59 | scanline[0] = kBlue; |
| 60 | scanline[1] = kRed; |
| 61 | for (int x = 2; x < width/2; ++x) { |
| 62 | scanline[x] = kWhite; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 63 | } |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 64 | for (int x = width/2; x < width-2; ++x) { |
| 65 | scanline[x] = kBlack; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 66 | } |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 67 | scanline[width-2] = kRed; |
| 68 | scanline[width-1] = kBlue; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 71 | scanline = result->getAddr32(0, height-2); |
| 72 | scanline[0] = kBlue; |
| 73 | for (int x = 1; x < width - 1; ++x) { |
| 74 | scanline[x] = kRed; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 75 | } |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 76 | scanline[width-1] = kBlue; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 77 | |
| 78 | scanline = result->getAddr32(0, height-1); |
| 79 | for (int x = 0; x < width; ++x) { |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 80 | scanline[x] = kBlue; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 81 | } |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 82 | result->setImmutable(); |
| 83 | } |
| 84 | |
| 85 | // This GM exercises the drawBitmapRectToRect "bleed" flag |
| 86 | class BleedGM : public skiagm::GM { |
| 87 | public: |
| 88 | BleedGM() {} |
| 89 | |
| 90 | protected: |
| 91 | virtual SkString onShortName() SK_OVERRIDE { |
| 92 | return SkString("bleed"); |
| 93 | } |
| 94 | |
| 95 | virtual SkISize onISize() SK_OVERRIDE { |
| 96 | return SkISize::Make(kWidth, kHeight); |
| 97 | } |
| 98 | |
| 99 | virtual void onOnceBeforeDraw() SK_OVERRIDE { |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 100 | make_ringed_bitmap(&fBitmapSmall, kSmallTextureSize, kSmallTextureSize); |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 101 | |
| 102 | // To exercise the GPU's tiling path we need a texture |
| 103 | // too big for the GPU to handle in one go |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 104 | make_ringed_bitmap(&fBitmapBig, 2*kMaxTextureSize, 2*kMaxTextureSize); |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 105 | } |
| 106 | |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 107 | // Draw only the center of the small bitmap |
| skia.committer@gmail.com | b74bdf0 | 2013-08-21 07:01:29 +0000 | [diff] [blame] | 108 | void drawCase1(SkCanvas* canvas, int transX, int transY, |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 109 | SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel filter) { |
| 110 | SkRect src = SkRect::MakeXYWH(2, 2, |
| 111 | kSmallTextureSize-4, |
| 112 | kSmallTextureSize-4); |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 113 | SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize)); |
| 114 | |
| 115 | SkPaint paint; |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 116 | paint.setFilterLevel(filter); |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 117 | |
| 118 | canvas->save(); |
| 119 | canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
| 120 | canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); |
| 121 | canvas->restore(); |
| 122 | } |
| 123 | |
| 124 | // Draw almost all of the large bitmap |
| skia.committer@gmail.com | b74bdf0 | 2013-08-21 07:01:29 +0000 | [diff] [blame] | 125 | void drawCase2(SkCanvas* canvas, int transX, int transY, |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 126 | SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel filter) { |
| 127 | SkRect src = SkRect::MakeXYWH(2, 2, |
| 128 | SkIntToScalar(fBitmapBig.width()-4), |
| 129 | SkIntToScalar(fBitmapBig.height()-4)); |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 130 | SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize)); |
| 131 | |
| 132 | SkPaint paint; |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 133 | paint.setFilterLevel(filter); |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 134 | |
| 135 | canvas->save(); |
| 136 | canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
| 137 | canvas->drawBitmapRectToRect(fBitmapBig, &src, dst, &paint, flags); |
| 138 | canvas->restore(); |
| 139 | } |
| 140 | |
| 141 | // Draw ~1/4 of the large bitmap |
| skia.committer@gmail.com | b74bdf0 | 2013-08-21 07:01:29 +0000 | [diff] [blame] | 142 | void drawCase3(SkCanvas* canvas, int transX, int transY, |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 143 | SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel filter) { |
| 144 | SkRect src = SkRect::MakeXYWH(2, 2, |
| 145 | SkIntToScalar(fBitmapBig.width()/2-2), |
| 146 | SkIntToScalar(fBitmapBig.height()/2-2)); |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 147 | SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize)); |
| 148 | |
| 149 | SkPaint paint; |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 150 | paint.setFilterLevel(filter); |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 151 | |
| 152 | canvas->save(); |
| 153 | canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
| 154 | canvas->drawBitmapRectToRect(fBitmapBig, &src, dst, &paint, flags); |
| 155 | canvas->restore(); |
| 156 | } |
| 157 | |
| robertphillips@google.com | 2cc0b47 | 2013-08-20 16:51:20 +0000 | [diff] [blame] | 158 | // Draw the center of the small bitmap with a mask filter |
| skia.committer@gmail.com | b74bdf0 | 2013-08-21 07:01:29 +0000 | [diff] [blame] | 159 | void drawCase4(SkCanvas* canvas, int transX, int transY, |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 160 | SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel filter) { |
| 161 | SkRect src = SkRect::MakeXYWH(2, 2, |
| 162 | kSmallTextureSize-4, |
| 163 | kSmallTextureSize-4); |
| robertphillips@google.com | 2cc0b47 | 2013-08-20 16:51:20 +0000 | [diff] [blame] | 164 | SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToScalar(kBlockSize)); |
| 165 | |
| 166 | SkPaint paint; |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 167 | paint.setFilterLevel(filter); |
| robertphillips@google.com | b706117 | 2013-09-06 14:16:12 +0000 | [diff] [blame] | 168 | SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle, |
| 169 | SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))); |
| robertphillips@google.com | 2cc0b47 | 2013-08-20 16:51:20 +0000 | [diff] [blame] | 170 | paint.setMaskFilter(mf)->unref(); |
| 171 | |
| 172 | canvas->save(); |
| 173 | canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
| 174 | canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); |
| 175 | canvas->restore(); |
| 176 | } |
| 177 | |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 178 | virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 179 | |
| 180 | canvas->clear(SK_ColorGRAY); |
| 181 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 182 | // Currently there are no test cases with medium filtering since medium uses mip-mapping and |
| 183 | // these draws are always upscaling. |
| 184 | |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 185 | // First draw a column with no bleeding, tiling, or filtering |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 186 | this->drawCase1(canvas, kCol0X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kNone_FilterLevel); |
| 187 | this->drawCase2(canvas, kCol0X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kNone_FilterLevel); |
| 188 | this->drawCase3(canvas, kCol0X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kNone_FilterLevel); |
| 189 | this->drawCase4(canvas, kCol0X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kNone_FilterLevel); |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 190 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 191 | // Then draw a column with no bleeding or tiling but with low filtering |
| 192 | this->drawCase1(canvas, kCol1X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 193 | this->drawCase2(canvas, kCol1X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 194 | this->drawCase3(canvas, kCol1X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 195 | this->drawCase4(canvas, kCol1X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 196 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 197 | // Then draw a column with no bleeding or tiling but with high filtering |
| 198 | this->drawCase1(canvas, kCol2X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 199 | this->drawCase2(canvas, kCol2X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 200 | this->drawCase3(canvas, kCol2X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 201 | this->drawCase4(canvas, kCol2X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 202 | |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 203 | #if SK_SUPPORT_GPU |
| mtklein@google.com | 62b50b7 | 2013-09-16 20:42:15 +0000 | [diff] [blame] | 204 | GrContext* ctx = GM::GetGr(canvas); |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 205 | int oldMaxTextureSize = 0; |
| 206 | if (NULL != ctx) { |
| 207 | // shrink the max texture size so all our textures can be reasonably sized |
| 208 | oldMaxTextureSize = ctx->getMaxTextureSize(); |
| 209 | ctx->setMaxTextureSizeOverride(kMaxTextureSize); |
| skia.committer@gmail.com | 956b310 | 2013-07-26 07:00:58 +0000 | [diff] [blame] | 210 | } |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 211 | #endif |
| skia.committer@gmail.com | 956b310 | 2013-07-26 07:00:58 +0000 | [diff] [blame] | 212 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 213 | // Then draw a column with no bleeding but with tiling and low filtering |
| 214 | this->drawCase1(canvas, kCol3X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 215 | this->drawCase2(canvas, kCol3X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 216 | this->drawCase3(canvas, kCol3X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 217 | this->drawCase4(canvas, kCol3X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 218 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 219 | // Then draw a column with no bleeding but with tiling and high filtering |
| 220 | this->drawCase1(canvas, kCol4X, kRow0Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 221 | this->drawCase2(canvas, kCol4X, kRow1Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 222 | this->drawCase3(canvas, kCol4X, kRow2Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 223 | this->drawCase4(canvas, kCol4X, kRow3Y, SkCanvas::kNone_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 224 | |
| 225 | // Then draw a column with bleeding, tiling, and low filtering |
| 226 | this->drawCase1(canvas, kCol5X, kRow0Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 227 | this->drawCase2(canvas, kCol5X, kRow1Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 228 | this->drawCase3(canvas, kCol5X, kRow2Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 229 | this->drawCase4(canvas, kCol5X, kRow3Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kLow_FilterLevel); |
| 230 | |
| 231 | // Finally draw a column with bleeding, tiling, and high filtering |
| 232 | this->drawCase1(canvas, kCol6X, kRow0Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 233 | this->drawCase2(canvas, kCol6X, kRow1Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 234 | this->drawCase3(canvas, kCol6X, kRow2Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| 235 | this->drawCase4(canvas, kCol6X, kRow3Y, SkCanvas::kBleed_DrawBitmapRectFlag, SkPaint::kHigh_FilterLevel); |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 236 | |
| 237 | #if SK_SUPPORT_GPU |
| 238 | if (NULL != ctx) { |
| 239 | ctx->setMaxTextureSizeOverride(oldMaxTextureSize); |
| skia.committer@gmail.com | 956b310 | 2013-07-26 07:00:58 +0000 | [diff] [blame] | 240 | } |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 241 | #endif |
| 242 | } |
| 243 | |
| 244 | private: |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 245 | static const int kBlockSize = 70; |
| 246 | static const int kBlockSpacing = 5; |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 247 | |
| 248 | static const int kCol0X = kBlockSpacing; |
| 249 | static const int kCol1X = 2*kBlockSpacing + kBlockSize; |
| 250 | static const int kCol2X = 3*kBlockSpacing + 2*kBlockSize; |
| 251 | static const int kCol3X = 4*kBlockSpacing + 3*kBlockSize; |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 252 | static const int kCol4X = 5*kBlockSpacing + 4*kBlockSize; |
| 253 | static const int kCol5X = 6*kBlockSpacing + 5*kBlockSize; |
| 254 | static const int kCol6X = 7*kBlockSpacing + 6*kBlockSize; |
| 255 | static const int kWidth = 8*kBlockSpacing + 7*kBlockSize; |
| robertphillips@google.com | d7ca661 | 2013-08-20 12:09:32 +0000 | [diff] [blame] | 256 | |
| 257 | static const int kRow0Y = kBlockSpacing; |
| 258 | static const int kRow1Y = 2*kBlockSpacing + kBlockSize; |
| 259 | static const int kRow2Y = 3*kBlockSpacing + 2*kBlockSize; |
| robertphillips@google.com | 2cc0b47 | 2013-08-20 16:51:20 +0000 | [diff] [blame] | 260 | static const int kRow3Y = 4*kBlockSpacing + 3*kBlockSize; |
| 261 | static const int kHeight = 5*kBlockSpacing + 4*kBlockSize; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 262 | |
| commit-bot@chromium.org | ec39b50 | 2013-11-08 15:09:22 +0000 | [diff] [blame^] | 263 | static const int kSmallTextureSize = 6; |
| robertphillips@google.com | aaa9b29 | 2013-07-25 21:34:00 +0000 | [diff] [blame] | 264 | static const int kMaxTextureSize = 32; |
| 265 | |
| 266 | SkBitmap fBitmapSmall; |
| 267 | SkBitmap fBitmapBig; |
| 268 | |
| 269 | typedef GM INHERITED; |
| 270 | }; |
| 271 | |
| 272 | DEF_GM( return new BleedGM(); ) |