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" |
11 #include "SkRasterClip.h" | 11 #include "SkRasterClip.h" |
12 #include "SkShader.h" | 12 #include "SkShader.h" |
| 13 #include "SkSurface.h" |
13 | 14 |
14 #define CHECK_FOR_ANNOTATION(paint) \ | 15 #define CHECK_FOR_ANNOTATION(paint) \ |
15 do { if (paint.getAnnotation()) { return; } } while (0) | 16 do { if (paint.getAnnotation()) { return; } } while (0) |
16 | 17 |
17 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) | 18 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) |
18 : fBitmap(bitmap) { | 19 : fBitmap(bitmap) { |
19 SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config()); | 20 SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config()); |
20 } | 21 } |
21 | 22 |
22 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties&
deviceProperties) | 23 SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties&
deviceProperties) |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode, | 375 draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode, |
375 indices, indexCount, paint); | 376 indices, indexCount, paint); |
376 } | 377 } |
377 | 378 |
378 void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device, | 379 void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device, |
379 int x, int y, const SkPaint& paint) { | 380 int x, int y, const SkPaint& paint) { |
380 const SkBitmap& src = device->accessBitmap(false); | 381 const SkBitmap& src = device->accessBitmap(false); |
381 draw.drawSprite(src, x, y, paint); | 382 draw.drawSprite(src, x, y, paint); |
382 } | 383 } |
383 | 384 |
| 385 SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) { |
| 386 return SkSurface::NewRaster(info); |
| 387 } |
| 388 |
384 /////////////////////////////////////////////////////////////////////////////// | 389 /////////////////////////////////////////////////////////////////////////////// |
385 | 390 |
386 bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) { | 391 bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) { |
387 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { | 392 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { |
388 // we're cool with the paint as is | 393 // we're cool with the paint as is |
389 return false; | 394 return false; |
390 } | 395 } |
391 | 396 |
392 if (SkBitmap::kARGB_8888_Config != fBitmap.config() || | 397 if (SkBitmap::kARGB_8888_Config != fBitmap.config() || |
393 paint.getRasterizer() || | 398 paint.getRasterizer() || |
394 paint.getPathEffect() || | 399 paint.getPathEffect() || |
395 paint.isFakeBoldText() || | 400 paint.isFakeBoldText() || |
396 paint.getStyle() != SkPaint::kFill_Style || | 401 paint.getStyle() != SkPaint::kFill_Style || |
397 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { | 402 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { |
398 // turn off lcd | 403 // turn off lcd |
399 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; | 404 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; |
400 flags->fHinting = paint.getHinting(); | 405 flags->fHinting = paint.getHinting(); |
401 return true; | 406 return true; |
402 } | 407 } |
403 // we're cool with the paint as is | 408 // we're cool with the paint as is |
404 return false; | 409 return false; |
405 } | 410 } |
OLD | NEW |