| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 157         } | 157         } | 
| 158 | 158 | 
| 159         // write directly to the device if it has pixels and is SkPMColor | 159         // write directly to the device if it has pixels and is SkPMColor | 
| 160         bool drawSprite; | 160         bool drawSprite; | 
| 161         if (SkBitmap::kARGB_8888_Config == dstBmp.config() && !dstBmp.isNull()) 
     { | 161         if (SkBitmap::kARGB_8888_Config == dstBmp.config() && !dstBmp.isNull()) 
     { | 
| 162             // we can write directly to the dst when doing the conversion | 162             // we can write directly to the dst when doing the conversion | 
| 163             dstBmp.extractSubset(&dstBmp, spriteRect); | 163             dstBmp.extractSubset(&dstBmp, spriteRect); | 
| 164             drawSprite = false; | 164             drawSprite = false; | 
| 165         } else { | 165         } else { | 
| 166             // we convert to a temporary bitmap and draw that as a sprite | 166             // we convert to a temporary bitmap and draw that as a sprite | 
| 167             dstBmp.setConfig(SkBitmap::kARGB_8888_Config, | 167             if (!dstBmp.allocPixels(SkImageInfo::MakeN32Premul(spriteRect.width(
     ), | 
| 168                              spriteRect.width(), | 168                                                                spriteRect.height
     ()))) { | 
| 169                              spriteRect.height()); |  | 
| 170             if (!dstBmp.allocPixels()) { |  | 
| 171                 return; | 169                 return; | 
| 172             } | 170             } | 
| 173             drawSprite = true; | 171             drawSprite = true; | 
| 174         } | 172         } | 
| 175 | 173 | 
| 176         // copy pixels to dstBmp and convert from config8888 to native config. | 174         // copy pixels to dstBmp and convert from config8888 to native config. | 
| 177         SkAutoLockPixels alp(bitmap); | 175         SkAutoLockPixels alp(bitmap); | 
| 178         uint32_t* srcPixels = bitmap.getAddr32(spriteRect.fLeft - x, | 176         uint32_t* srcPixels = bitmap.getAddr32(spriteRect.fLeft - x, | 
| 179                                                spriteRect.fTop - y); | 177                                                spriteRect.fTop - y); | 
| 180         SkCopyConfig8888ToBitmap(dstBmp, | 178         SkCopyConfig8888ToBitmap(dstBmp, | 
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 398         paint.getStyle() != SkPaint::kFill_Style || | 396         paint.getStyle() != SkPaint::kFill_Style || | 
| 399         !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 397         !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 
| 400         // turn off lcd | 398         // turn off lcd | 
| 401         flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 399         flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 
| 402         flags->fHinting = paint.getHinting(); | 400         flags->fHinting = paint.getHinting(); | 
| 403         return true; | 401         return true; | 
| 404     } | 402     } | 
| 405     // we're cool with the paint as is | 403     // we're cool with the paint as is | 
| 406     return false; | 404     return false; | 
| 407 } | 405 } | 
| OLD | NEW | 
|---|