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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 int x, int y, const SkPaint& paint) { | 433 int x, int y, const SkPaint& paint) { |
434 const SkBitmap& src = device->accessBitmap(false); | 434 const SkBitmap& src = device->accessBitmap(false); |
435 draw.drawSprite(src, x, y, paint); | 435 draw.drawSprite(src, x, y, paint); |
436 } | 436 } |
437 | 437 |
438 SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) { | 438 SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) { |
439 return SkSurface::NewRaster(info); | 439 return SkSurface::NewRaster(info); |
440 } | 440 } |
441 | 441 |
442 const void* SkBitmapDevice::peekPixels(SkImageInfo* info, size_t* rowBytes) { | 442 const void* SkBitmapDevice::peekPixels(SkImageInfo* info, size_t* rowBytes) { |
443 if (fBitmap.getPixels() && fBitmap.asImageInfo(info)) { | 443 const SkImageInfo bmInfo = fBitmap.info(); |
| 444 if (fBitmap.getPixels() && (kUnknown_SkColorType != bmInfo.colorType())) { |
| 445 if (info) { |
| 446 *info = bmInfo; |
| 447 } |
444 if (rowBytes) { | 448 if (rowBytes) { |
445 *rowBytes = fBitmap.rowBytes(); | 449 *rowBytes = fBitmap.rowBytes(); |
446 } | 450 } |
447 return fBitmap.getPixels(); | 451 return fBitmap.getPixels(); |
448 } | 452 } |
449 return NULL; | 453 return NULL; |
450 } | 454 } |
451 | 455 |
452 /////////////////////////////////////////////////////////////////////////////// | 456 /////////////////////////////////////////////////////////////////////////////// |
453 | 457 |
(...skipping 10 matching lines...) Expand all Loading... |
464 paint.getStyle() != SkPaint::kFill_Style || | 468 paint.getStyle() != SkPaint::kFill_Style || |
465 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 469 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
466 // turn off lcd | 470 // turn off lcd |
467 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 471 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
468 flags->fHinting = paint.getHinting(); | 472 flags->fHinting = paint.getHinting(); |
469 return true; | 473 return true; |
470 } | 474 } |
471 // we're cool with the paint as is | 475 // we're cool with the paint as is |
472 return false; | 476 return false; |
473 } | 477 } |
OLD | NEW |