| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "Test.h" | 8 #include "Test.h" |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 SkPaint paint2; | 96 SkPaint paint2; |
| 97 // CreateBitmapShader is too smart for us; an empty (or 1x1) bitmap shader | 97 // CreateBitmapShader is too smart for us; an empty (or 1x1) bitmap shader |
| 98 // gets optimized into a non-bitmap form, so we create a 2x2 bitmap here. | 98 // gets optimized into a non-bitmap form, so we create a 2x2 bitmap here. |
| 99 SkBitmap bitmap2; | 99 SkBitmap bitmap2; |
| 100 bitmap2.allocPixels(SkImageInfo::MakeN32Premul(2, 2)); | 100 bitmap2.allocPixels(SkImageInfo::MakeN32Premul(2, 2)); |
| 101 bitmap2.eraseColor(SK_ColorBLUE); | 101 bitmap2.eraseColor(SK_ColorBLUE); |
| 102 *(bitmap2.getAddr32(0, 0)) = SK_ColorGREEN; | 102 *(bitmap2.getAddr32(0, 0)) = SK_ColorGREEN; |
| 103 SkShader* shader = SkShader::CreateBitmapShader(bitmap2, SkShader::kClamp_Ti
leMode, | 103 SkShader* shader = SkShader::CreateBitmapShader(bitmap2, SkShader::kClamp_Ti
leMode, |
| 104 SkShader::kClamp_TileMode); | 104 SkShader::kClamp_TileMode); |
| 105 paint2.setShader(shader); | 105 paint2.setShader(shader)->unref(); |
| 106 REPORTER_ASSERT(r, shader->asABitmap(NULL, NULL, NULL) == SkShader::kDefault
_BitmapType); | 106 REPORTER_ASSERT(r, shader->asABitmap(NULL, NULL, NULL) == SkShader::kDefault
_BitmapType); |
| 107 | 107 |
| 108 APPEND(record, SkRecords::DrawRect, paint2, rect); | 108 APPEND(record, SkRecords::DrawRect, paint2, rect); |
| 109 REPORTER_ASSERT(r, SkRecordWillPlaybackBitmaps(record)); | 109 REPORTER_ASSERT(r, SkRecordWillPlaybackBitmaps(record)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 #undef APPEND | 112 #undef APPEND |
| 113 | 113 |
| OLD | NEW |