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 "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 345 } |
346 rect_memcpy(dstPixels, dstRowBytes, srcPixels, srcRowBytes, | 346 rect_memcpy(dstPixels, dstRowBytes, srcPixels, srcRowBytes, |
347 srcInfo.width() * srcInfo.bytesPerPixel(), srcInfo.height())
; | 347 srcInfo.width() * srcInfo.bytesPerPixel(), srcInfo.height())
; |
348 } | 348 } |
349 // TODO: add support for more conversions as needed | 349 // TODO: add support for more conversions as needed |
350 return false; | 350 return false; |
351 } | 351 } |
352 | 352 |
353 bool SkBitmapDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPi
xels, | 353 bool SkBitmapDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPi
xels, |
354 size_t srcRowBytes, int x, int y) { | 354 size_t srcRowBytes, int x, int y) { |
| 355 // since we don't stop creating un-pixeled devices yet, check for no pixels
here |
| 356 if (NULL == fBitmap.getPixels()) { |
| 357 return false; |
| 358 } |
| 359 |
355 SkImageInfo dstInfo = fBitmap.info(); | 360 SkImageInfo dstInfo = fBitmap.info(); |
356 dstInfo.fWidth = srcInfo.width(); | 361 dstInfo.fWidth = srcInfo.width(); |
357 dstInfo.fHeight = srcInfo.height(); | 362 dstInfo.fHeight = srcInfo.height(); |
358 | 363 |
359 void* dstPixels = fBitmap.getAddr(x, y); | 364 void* dstPixels = fBitmap.getAddr(x, y); |
360 size_t dstRowBytes = fBitmap.rowBytes(); | 365 size_t dstRowBytes = fBitmap.rowBytes(); |
361 | 366 |
362 if (write_pixels(dstInfo, dstPixels, dstRowBytes, srcInfo, srcPixels, srcRow
Bytes)) { | 367 if (write_pixels(dstInfo, dstPixels, dstRowBytes, srcInfo, srcPixels, srcRow
Bytes)) { |
363 fBitmap.notifyPixelsChanged(); | 368 fBitmap.notifyPixelsChanged(); |
364 return true; | 369 return true; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 paint.getStyle() != SkPaint::kFill_Style || | 580 paint.getStyle() != SkPaint::kFill_Style || |
576 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 581 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
577 // turn off lcd | 582 // turn off lcd |
578 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 583 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
579 flags->fHinting = paint.getHinting(); | 584 flags->fHinting = paint.getHinting(); |
580 return true; | 585 return true; |
581 } | 586 } |
582 // we're cool with the paint as is | 587 // we're cool with the paint as is |
583 return false; | 588 return false; |
584 } | 589 } |
OLD | NEW |