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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 SkBitmap bmp; | 322 SkBitmap bmp; |
323 size_t rowBytes = c.fTightRowBytes ? 0 : 4 * DEV_W + 100; | 323 size_t rowBytes = c.fTightRowBytes ? 0 : 4 * DEV_W + 100; |
324 SkImageInfo info = SkImageInfo::MakeN32Premul(DEV_W, DEV_H); | 324 SkImageInfo info = SkImageInfo::MakeN32Premul(DEV_W, DEV_H); |
325 if (!allocRowBytes(&bmp, info, rowBytes)) { | 325 if (!allocRowBytes(&bmp, info, rowBytes)) { |
326 sk_throw(); | 326 sk_throw(); |
327 return NULL; | 327 return NULL; |
328 } | 328 } |
329 // if rowBytes isn't tight then set the padding to a known value | 329 // if rowBytes isn't tight then set the padding to a known value |
330 if (rowBytes) { | 330 if (rowBytes) { |
331 SkAutoLockPixels alp(bmp); | 331 SkAutoLockPixels alp(bmp); |
332 memset(bmp.getPixels(), DEV_PAD, bmp.getSafeSize()); | 332 // We'd just use memset here but GCC 4.8.1 throws up a bogus war
ning when we do. |
| 333 for (size_t i = 0; i < bmp.getSafeSize(); i++) { |
| 334 ((uint8_t*)bmp.getPixels())[i] = DEV_PAD; |
| 335 } |
333 } | 336 } |
334 return new SkBitmapDevice(bmp); | 337 return new SkBitmapDevice(bmp); |
335 } | 338 } |
336 #if SK_SUPPORT_GPU | 339 #if SK_SUPPORT_GPU |
337 case kGpu_BottomLeft_DevType: | 340 case kGpu_BottomLeft_DevType: |
338 case kGpu_TopLeft_DevType: | 341 case kGpu_TopLeft_DevType: |
339 GrTextureDesc desc; | 342 GrTextureDesc desc; |
340 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 343 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
341 desc.fWidth = DEV_W; | 344 desc.fWidth = DEV_W; |
342 desc.fHeight = DEV_H; | 345 desc.fHeight = DEV_H; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, | 483 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, |
481 bmp.width(), bmp.h
eight()); | 484 bmp.width(), bmp.h
eight()); |
482 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; | 485 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; |
483 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); | 486 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); |
484 } | 487 } |
485 } | 488 } |
486 } | 489 } |
487 } | 490 } |
488 } | 491 } |
489 } | 492 } |
OLD | NEW |