OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 canvas.clear(0x00000000); | 226 canvas.clear(0x00000000); |
227 SkPaint paint; | 227 SkPaint paint; |
228 paint.setImageFilter(deserializedFilter); | 228 paint.setImageFilter(deserializedFilter); |
229 canvas.clipRect(SkRect::MakeXYWH(0, 0, SkIntToScalar(24), SkIntToScalar(
24))); | 229 canvas.clipRect(SkRect::MakeXYWH(0, 0, SkIntToScalar(24), SkIntToScalar(
24))); |
230 canvas.drawBitmap(bitmap, 0, 0, &paint); | 230 canvas.drawBitmap(bitmap, 0, 0, &paint); |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 static bool setup_bitmap_for_canvas(SkBitmap* bitmap) { | 234 static bool setup_bitmap_for_canvas(SkBitmap* bitmap) { |
235 SkImageInfo info = SkImageInfo::Make( | 235 SkImageInfo info = SkImageInfo::Make( |
236 kBitmapSize, kBitmapSize, kN32_SkColorType, kPremul_SkAlphaType); | 236 kBitmapSize, kBitmapSize, kPMColor_SkColorType, kPremul_SkAlphaType); |
237 return bitmap->allocPixels(info); | 237 return bitmap->allocPixels(info); |
238 } | 238 } |
239 | 239 |
240 static bool make_checkerboard_bitmap(SkBitmap& bitmap) { | 240 static bool make_checkerboard_bitmap(SkBitmap& bitmap) { |
241 bool success = setup_bitmap_for_canvas(&bitmap); | 241 bool success = setup_bitmap_for_canvas(&bitmap); |
242 | 242 |
243 SkCanvas canvas(bitmap); | 243 SkCanvas canvas(bitmap); |
244 canvas.clear(0x00000000); | 244 canvas.clear(0x00000000); |
245 SkPaint darkPaint; | 245 SkPaint darkPaint; |
246 darkPaint.setColor(0xFF804020); | 246 darkPaint.setColor(0xFF804020); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 SkAutoTMalloc<unsigned char> data(size); | 382 SkAutoTMalloc<unsigned char> data(size); |
383 writer.writeToMemory(static_cast<void*>(data.get())); | 383 writer.writeToMemory(static_cast<void*>(data.get())); |
384 | 384 |
385 // Deserialize picture | 385 // Deserialize picture |
386 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); | 386 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); |
387 SkAutoTUnref<SkPicture> readPict( | 387 SkAutoTUnref<SkPicture> readPict( |
388 SkPicture::CreateFromBuffer(reader)); | 388 SkPicture::CreateFromBuffer(reader)); |
389 REPORTER_ASSERT(reporter, NULL != readPict.get()); | 389 REPORTER_ASSERT(reporter, NULL != readPict.get()); |
390 } | 390 } |
391 } | 391 } |
OLD | NEW |