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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.setInfo(info)) { |
82 return NULL; | 82 return NULL; |
83 } | 83 } |
84 } else { | 84 } else { |
85 if (!bitmap.allocPixels(info)) { | 85 if (!bitmap.tryAllocPixels(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 } |
92 | 92 |
93 if (props) { | 93 if (props) { |
94 return SkNEW_ARGS(SkBitmapDevice, (bitmap, *props)); | 94 return SkNEW_ARGS(SkBitmapDevice, (bitmap, *props)); |
95 } else { | 95 } else { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 paint.getStyle() != SkPaint::kFill_Style || | 388 paint.getStyle() != SkPaint::kFill_Style || |
389 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 389 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
390 // turn off lcd | 390 // turn off lcd |
391 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 391 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
392 flags->fHinting = paint.getHinting(); | 392 flags->fHinting = paint.getHinting(); |
393 return true; | 393 return true; |
394 } | 394 } |
395 // we're cool with the paint as is | 395 // we're cool with the paint as is |
396 return false; | 396 return false; |
397 } | 397 } |
OLD | NEW |