OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
11 #include "effects/GrDashingEffect.h" | 11 #include "effects/GrDashingEffect.h" |
12 #include "effects/GrTextureDomain.h" | 12 #include "effects/GrTextureDomain.h" |
13 #include "effects/GrSimpleTextureEffect.h" | 13 #include "effects/GrSimpleTextureEffect.h" |
14 | 14 |
15 #include "GrContext.h" | 15 #include "GrContext.h" |
16 #include "GrBitmapTextContext.h" | 16 #include "GrBitmapTextContext.h" |
17 #include "GrDistanceFieldTextContext.h" | 17 #include "GrDistanceFieldTextContext.h" |
18 #include "GrLayerCache.h" | 18 #include "GrLayerCache.h" |
19 #include "GrPictureUtils.h" | 19 #include "GrPictureUtils.h" |
20 #include "GrStrokeInfo.h" | 20 #include "GrStrokeInfo.h" |
| 21 #include "GrTracing.h" |
21 | 22 |
22 #include "SkGrTexturePixelRef.h" | 23 #include "SkGrTexturePixelRef.h" |
23 | 24 |
24 #include "SkDeviceImageFilterProxy.h" | 25 #include "SkDeviceImageFilterProxy.h" |
25 #include "SkDrawProcs.h" | 26 #include "SkDrawProcs.h" |
26 #include "SkGlyphCache.h" | 27 #include "SkGlyphCache.h" |
27 #include "SkImageFilter.h" | 28 #include "SkImageFilter.h" |
28 #include "SkMaskFilter.h" | 29 #include "SkMaskFilter.h" |
29 #include "SkPathEffect.h" | 30 #include "SkPathEffect.h" |
30 #include "SkPicture.h" | 31 #include "SkPicture.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 NULL, | 414 NULL, |
414 NULL, | 415 NULL, |
415 NULL, | 416 NULL, |
416 0); | 417 0); |
417 } | 418 } |
418 | 419 |
419 /////////////////////////////////////////////////////////////////////////////// | 420 /////////////////////////////////////////////////////////////////////////////// |
420 | 421 |
421 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, | 422 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, |
422 const SkPaint& paint) { | 423 const SkPaint& paint) { |
| 424 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRect", fContext); |
| 425 |
423 CHECK_FOR_ANNOTATION(paint); | 426 CHECK_FOR_ANNOTATION(paint); |
424 CHECK_SHOULD_DRAW(draw, false); | 427 CHECK_SHOULD_DRAW(draw, false); |
425 | 428 |
426 bool doStroke = paint.getStyle() != SkPaint::kFill_Style; | 429 bool doStroke = paint.getStyle() != SkPaint::kFill_Style; |
427 SkScalar width = paint.getStrokeWidth(); | 430 SkScalar width = paint.getStrokeWidth(); |
428 | 431 |
429 /* | 432 /* |
430 We have special code for hairline strokes, miter-strokes, bevel-stroke | 433 We have special code for hairline strokes, miter-strokes, bevel-stroke |
431 and fills. Anything else we just call our path code. | 434 and fills. Anything else we just call our path code. |
432 */ | 435 */ |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 } else { | 1707 } else { |
1705 // this guy will just call our drawPath() | 1708 // this guy will just call our drawPath() |
1706 draw.drawText_asPaths((const char*)text, byteLength, x, y, paint); | 1709 draw.drawText_asPaths((const char*)text, byteLength, x, y, paint); |
1707 } | 1710 } |
1708 } | 1711 } |
1709 | 1712 |
1710 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, | 1713 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, |
1711 size_t byteLength, const SkScalar pos[], | 1714 size_t byteLength, const SkScalar pos[], |
1712 SkScalar constY, int scalarsPerPos, | 1715 SkScalar constY, int scalarsPerPos, |
1713 const SkPaint& paint) { | 1716 const SkPaint& paint) { |
| 1717 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext); |
1714 CHECK_SHOULD_DRAW(draw, false); | 1718 CHECK_SHOULD_DRAW(draw, false); |
1715 | 1719 |
1716 if (fMainTextContext->canDraw(paint)) { | 1720 if (fMainTextContext->canDraw(paint)) { |
1717 GrPaint grPaint; | 1721 GrPaint grPaint; |
1718 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); | 1722 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
1719 | 1723 |
1720 SkDEBUGCODE(this->validate();) | 1724 SkDEBUGCODE(this->validate();) |
1721 | 1725 |
1722 fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLe
ngth, pos, | 1726 fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLe
ngth, pos, |
1723 constY, scalarsPerPos); | 1727 constY, scalarsPerPos); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); | 2006 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); |
2003 | 2007 |
2004 if (NULL != layer->getTexture()) { | 2008 if (NULL != layer->getTexture()) { |
2005 fContext->unlockScratchTexture(layer->getTexture()); | 2009 fContext->unlockScratchTexture(layer->getTexture()); |
2006 layer->setTexture(NULL); | 2010 layer->setTexture(NULL); |
2007 } | 2011 } |
2008 } | 2012 } |
2009 | 2013 |
2010 return true; | 2014 return true; |
2011 } | 2015 } |
OLD | NEW |