| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo, | 71 SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo, |
| 72 const SkDeviceProperties* props) { | 72 const SkDeviceProperties* props) { |
| 73 SkImageInfo info = origInfo; | 73 SkImageInfo info = origInfo; |
| 74 if (!valid_for_bitmap_device(info, &info.fAlphaType)) { | 74 if (!valid_for_bitmap_device(info, &info.fAlphaType)) { |
| 75 return NULL; | 75 return NULL; |
| 76 } | 76 } |
| 77 | 77 |
| 78 SkBitmap bitmap; | 78 SkBitmap bitmap; |
| 79 | 79 |
| 80 if (kUnknown_SkColorType == info.colorType()) { | 80 if (kUnknown_SkColorType == info.colorType()) { |
| 81 if (!bitmap.setInfo(info)) { | 81 if (!bitmap.setConfig(info)) { |
| 82 return NULL; | 82 return NULL; |
| 83 } | 83 } |
| 84 } else { | 84 } else { |
| 85 if (!bitmap.allocPixels(info)) { | 85 if (!bitmap.allocPixels(info)) { |
| 86 return NULL; | 86 return NULL; |
| 87 } | 87 } |
| 88 if (!bitmap.info().isOpaque()) { | 88 if (!bitmap.info().isOpaque()) { |
| 89 bitmap.eraseColor(SK_ColorTRANSPARENT); | 89 bitmap.eraseColor(SK_ColorTRANSPARENT); |
| 90 } | 90 } |
| 91 } | 91 } |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 paint.getStyle() != SkPaint::kFill_Style || | 468 paint.getStyle() != SkPaint::kFill_Style || |
| 469 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 469 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
| 470 // turn off lcd | 470 // turn off lcd |
| 471 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 471 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
| 472 flags->fHinting = paint.getHinting(); | 472 flags->fHinting = paint.getHinting(); |
| 473 return true; | 473 return true; |
| 474 } | 474 } |
| 475 // we're cool with the paint as is | 475 // we're cool with the paint as is |
| 476 return false; | 476 return false; |
| 477 } | 477 } |
| OLD | NEW |