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/GrTextureDomainEffect.h" | 10 #include "effects/GrTextureDomainEffect.h" |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 GrTexture* texture; | 1469 GrTexture* texture; |
1470 // draw sprite uses the default texture params | 1470 // draw sprite uses the default texture params |
1471 SkAutoCachedTexture act(this, bitmap, NULL, &texture); | 1471 SkAutoCachedTexture act(this, bitmap, NULL, &texture); |
1472 | 1472 |
1473 SkImageFilter* filter = paint.getImageFilter(); | 1473 SkImageFilter* filter = paint.getImageFilter(); |
1474 SkIPoint offset = SkIPoint::Make(left, top); | 1474 SkIPoint offset = SkIPoint::Make(left, top); |
1475 // This bitmap will own the filtered result as a texture. | 1475 // This bitmap will own the filtered result as a texture. |
1476 SkBitmap filteredBitmap; | 1476 SkBitmap filteredBitmap; |
1477 | 1477 |
1478 if (NULL != filter) { | 1478 if (NULL != filter) { |
1479 if (filter_texture(this, fContext, texture, filter, w, h, SkMatrix::I(),
&filteredBitmap, | 1479 SkMatrix matrix(*draw.fMatrix); |
| 1480 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top)); |
| 1481 if (filter_texture(this, fContext, texture, filter, w, h, matrix, &filte
redBitmap, |
1480 &offset)) { | 1482 &offset)) { |
1481 texture = (GrTexture*) filteredBitmap.getTexture(); | 1483 texture = (GrTexture*) filteredBitmap.getTexture(); |
1482 w = filteredBitmap.width(); | 1484 w = filteredBitmap.width(); |
1483 h = filteredBitmap.height(); | 1485 h = filteredBitmap.height(); |
1484 } else { | 1486 } else { |
1485 return; | 1487 return; |
1486 } | 1488 } |
1487 } | 1489 } |
1488 | 1490 |
1489 GrPaint grPaint; | 1491 GrPaint grPaint; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 const SkBitmap& bm = dev->accessBitmap(false); | 1558 const SkBitmap& bm = dev->accessBitmap(false); |
1557 int w = bm.width(); | 1559 int w = bm.width(); |
1558 int h = bm.height(); | 1560 int h = bm.height(); |
1559 | 1561 |
1560 SkImageFilter* filter = paint.getImageFilter(); | 1562 SkImageFilter* filter = paint.getImageFilter(); |
1561 // This bitmap will own the filtered result as a texture. | 1563 // This bitmap will own the filtered result as a texture. |
1562 SkBitmap filteredBitmap; | 1564 SkBitmap filteredBitmap; |
1563 | 1565 |
1564 if (NULL != filter) { | 1566 if (NULL != filter) { |
1565 SkIPoint offset = SkIPoint::Make(0, 0); | 1567 SkIPoint offset = SkIPoint::Make(0, 0); |
1566 if (filter_texture(this, fContext, devTex, filter, w, h, SkMatrix::I(),
&filteredBitmap, | 1568 SkMatrix matrix(*draw.fMatrix); |
| 1569 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
| 1570 if (filter_texture(this, fContext, devTex, filter, w, h, matrix, &filter
edBitmap, |
1567 &offset)) { | 1571 &offset)) { |
1568 devTex = filteredBitmap.getTexture(); | 1572 devTex = filteredBitmap.getTexture(); |
1569 w = filteredBitmap.width(); | 1573 w = filteredBitmap.width(); |
1570 h = filteredBitmap.height(); | 1574 h = filteredBitmap.height(); |
1571 x += offset.fX; | 1575 x += offset.fX; |
1572 y += offset.fY; | 1576 y += offset.fY; |
1573 } else { | 1577 } else { |
1574 return; | 1578 return; |
1575 } | 1579 } |
1576 } | 1580 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 GrTexture* texture, | 1859 GrTexture* texture, |
1856 bool needClear) | 1860 bool needClear) |
1857 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { | 1861 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { |
1858 | 1862 |
1859 SkASSERT(texture && texture->asRenderTarget()); | 1863 SkASSERT(texture && texture->asRenderTarget()); |
1860 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1864 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
1861 // cache. We pass true for the third argument so that it will get unlocked. | 1865 // cache. We pass true for the third argument so that it will get unlocked. |
1862 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1866 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
1863 fNeedClear = needClear; | 1867 fNeedClear = needClear; |
1864 } | 1868 } |
OLD | NEW |