OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkDevice.h" | 8 #include "SkDevice.h" |
9 #include "SkDeviceProperties.h" | 9 #include "SkDeviceProperties.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 bool result = this->onReadPixels(bmpSubset, | 212 bool result = this->onReadPixels(bmpSubset, |
213 srcRect.fLeft, | 213 srcRect.fLeft, |
214 srcRect.fTop, | 214 srcRect.fTop, |
215 config8888); | 215 config8888); |
216 if (result && bmp == &tmp) { | 216 if (result && bmp == &tmp) { |
217 tmp.swap(*bitmap); | 217 tmp.swap(*bitmap); |
218 } | 218 } |
219 return result; | 219 return result; |
220 } | 220 } |
221 | 221 |
222 #ifdef SK_CPU_LENDIAN | 222 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) |
223 #if 24 == SK_A32_SHIFT && 16 == SK_R32_SHIFT && \ | 223 const SkCanvas::Config8888 SkDevice::kPMColorAlias = |
224 8 == SK_G32_SHIFT && 0 == SK_B32_SHIFT | 224 SkCanvas::kBGRA_Premul_Config8888; |
225 const SkCanvas::Config8888 SkDevice::kPMColorAlias = | 225 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) |
226 SkCanvas::kBGRA_Premul_Config8888; | 226 const SkCanvas::Config8888 SkDevice::kPMColorAlias = |
227 #elif 24 == SK_A32_SHIFT && 0 == SK_R32_SHIFT && \ | 227 SkCanvas::kRGBA_Premul_Config8888; |
228 8 == SK_G32_SHIFT && 16 == SK_B32_SHIFT | |
229 const SkCanvas::Config8888 SkDevice::kPMColorAlias = | |
230 SkCanvas::kRGBA_Premul_Config8888; | |
231 #else | |
232 const SkCanvas::Config8888 SkDevice::kPMColorAlias = | |
233 (SkCanvas::Config8888) -1; | |
234 #endif | |
235 #else | 228 #else |
236 #if 0 == SK_A32_SHIFT && 8 == SK_R32_SHIFT && \ | 229 const SkCanvas::Config8888 SkDevice::kPMColorAlias = |
237 16 == SK_G32_SHIFT && 24 == SK_B32_SHIFT | 230 (SkCanvas::Config8888) -1; |
238 const SkCanvas::Config8888 SkDevice::kPMColorAlias = | |
239 SkCanvas::kBGRA_Premul_Config8888; | |
240 #elif 0 == SK_A32_SHIFT && 24 == SK_R32_SHIFT && \ | |
241 16 == SK_G32_SHIFT && 8 == SK_B32_SHIFT | |
242 const SkCanvas::Config8888 SkDevice::kPMColorAlias = | |
243 SkCanvas::kRGBA_Premul_Config8888; | |
244 #else | |
245 const SkCanvas::Config8888 SkDevice::kPMColorAlias = | |
246 (SkCanvas::Config8888) -1; | |
247 #endif | |
248 #endif | 231 #endif |
249 | 232 |
250 #include <SkConfig8888.h> | 233 #include <SkConfig8888.h> |
251 | 234 |
252 bool SkDevice::onReadPixels(const SkBitmap& bitmap, | 235 bool SkDevice::onReadPixels(const SkBitmap& bitmap, |
253 int x, int y, | 236 int x, int y, |
254 SkCanvas::Config8888 config8888) { | 237 SkCanvas::Config8888 config8888) { |
255 SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config()); | 238 SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config()); |
256 SkASSERT(!bitmap.isNull()); | 239 SkASSERT(!bitmap.isNull()); |
257 SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(SkIRect::Ma
keXYWH(x, y, bitmap.width(), bitmap.height()))); | 240 SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(SkIRect::Ma
keXYWH(x, y, bitmap.width(), bitmap.height()))); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 paint.getStyle() != SkPaint::kFill_Style || | 533 paint.getStyle() != SkPaint::kFill_Style || |
551 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 534 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
552 // turn off lcd | 535 // turn off lcd |
553 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 536 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
554 flags->fHinting = paint.getHinting(); | 537 flags->fHinting = paint.getHinting(); |
555 return true; | 538 return true; |
556 } | 539 } |
557 // we're cool with the paint as is | 540 // we're cool with the paint as is |
558 return false; | 541 return false; |
559 } | 542 } |
OLD | NEW |