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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 bitmap
.width(), | 182 bitmap
.width(), |
183 bitmap
.height()))); | 183 bitmap
.height()))); |
184 | 184 |
185 SkIRect srcRect = SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()); | 185 SkIRect srcRect = SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()); |
186 const SkBitmap& src = this->accessBitmap(false); | 186 const SkBitmap& src = this->accessBitmap(false); |
187 | 187 |
188 SkBitmap subset; | 188 SkBitmap subset; |
189 if (!src.extractSubset(&subset, srcRect)) { | 189 if (!src.extractSubset(&subset, srcRect)) { |
190 return false; | 190 return false; |
191 } | 191 } |
192 if (SkBitmap::kARGB_8888_Config != subset.config()) { | 192 if (kPMColor_SkColorType != subset.colorType()) { |
193 // It'd be preferable to do this directly to bitmap. | 193 // It'd be preferable to do this directly to bitmap. |
194 subset.copyTo(&subset, SkBitmap::kARGB_8888_Config); | 194 subset.copyTo(&subset, kPMColor_SkColorType); |
195 } | 195 } |
196 SkAutoLockPixels alp(bitmap); | 196 SkAutoLockPixels alp(bitmap); |
197 uint32_t* bmpPixels = reinterpret_cast<uint32_t*>(bitmap.getPixels()); | 197 uint32_t* bmpPixels = reinterpret_cast<uint32_t*>(bitmap.getPixels()); |
198 SkCopyBitmapToConfig8888(bmpPixels, bitmap.rowBytes(), config8888, subset); | 198 SkCopyBitmapToConfig8888(bmpPixels, bitmap.rowBytes(), config8888, subset); |
199 return true; | 199 return true; |
200 } | 200 } |
201 | 201 |
202 void SkBitmapDevice::writePixels(const SkBitmap& bitmap, | 202 void SkBitmapDevice::writePixels(const SkBitmap& bitmap, |
203 int x, int y, | 203 int x, int y, |
204 SkCanvas::Config8888 config8888) { | 204 SkCanvas::Config8888 config8888) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 paint.getStyle() != SkPaint::kFill_Style || | 475 paint.getStyle() != SkPaint::kFill_Style || |
476 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 476 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
477 // turn off lcd | 477 // turn off lcd |
478 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 478 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
479 flags->fHinting = paint.getHinting(); | 479 flags->fHinting = paint.getHinting(); |
480 return true; | 480 return true; |
481 } | 481 } |
482 // we're cool with the paint as is | 482 // we're cool with the paint as is |
483 return false; | 483 return false; |
484 } | 484 } |
OLD | NEW |