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" |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 | 1529 |
1530 SkImageFilter* filter = paint.getImageFilter(); | 1530 SkImageFilter* filter = paint.getImageFilter(); |
1531 // This bitmap will own the filtered result as a texture. | 1531 // This bitmap will own the filtered result as a texture. |
1532 SkBitmap filteredBitmap; | 1532 SkBitmap filteredBitmap; |
1533 | 1533 |
1534 if (NULL != filter) { | 1534 if (NULL != filter) { |
1535 SkIPoint offset = SkIPoint::Make(0, 0); | 1535 SkIPoint offset = SkIPoint::Make(0, 0); |
1536 SkMatrix matrix(*draw.fMatrix); | 1536 SkMatrix matrix(*draw.fMatrix); |
1537 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top)); | 1537 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top)); |
1538 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height()); | 1538 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height()); |
1539 SkImageFilter::Context ctx(matrix, clipBounds); | 1539 SkImageFilter::Cache* cache = SkImageFilter::Cache::Create(); |
| 1540 SkAutoUnref aur(cache); |
| 1541 SkImageFilter::Context ctx(matrix, clipBounds, cache); |
1540 if (filter_texture(this, fContext, texture, filter, w, h, ctx, &filtered
Bitmap, | 1542 if (filter_texture(this, fContext, texture, filter, w, h, ctx, &filtered
Bitmap, |
1541 &offset)) { | 1543 &offset)) { |
1542 texture = (GrTexture*) filteredBitmap.getTexture(); | 1544 texture = (GrTexture*) filteredBitmap.getTexture(); |
1543 w = filteredBitmap.width(); | 1545 w = filteredBitmap.width(); |
1544 h = filteredBitmap.height(); | 1546 h = filteredBitmap.height(); |
1545 left += offset.x(); | 1547 left += offset.x(); |
1546 top += offset.y(); | 1548 top += offset.y(); |
1547 } else { | 1549 } else { |
1548 return; | 1550 return; |
1549 } | 1551 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 | 1639 |
1638 SkImageFilter* filter = paint.getImageFilter(); | 1640 SkImageFilter* filter = paint.getImageFilter(); |
1639 // This bitmap will own the filtered result as a texture. | 1641 // This bitmap will own the filtered result as a texture. |
1640 SkBitmap filteredBitmap; | 1642 SkBitmap filteredBitmap; |
1641 | 1643 |
1642 if (NULL != filter) { | 1644 if (NULL != filter) { |
1643 SkIPoint offset = SkIPoint::Make(0, 0); | 1645 SkIPoint offset = SkIPoint::Make(0, 0); |
1644 SkMatrix matrix(*draw.fMatrix); | 1646 SkMatrix matrix(*draw.fMatrix); |
1645 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); | 1647 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
1646 SkIRect clipBounds = SkIRect::MakeWH(devTex->width(), devTex->height()); | 1648 SkIRect clipBounds = SkIRect::MakeWH(devTex->width(), devTex->height()); |
1647 SkImageFilter::Context ctx(matrix, clipBounds); | 1649 SkImageFilter::Cache* cache = SkImageFilter::Cache::Create(); |
| 1650 SkAutoUnref aur(cache); |
| 1651 SkImageFilter::Context ctx(matrix, clipBounds, cache); |
1648 if (filter_texture(this, fContext, devTex, filter, w, h, ctx, &filteredB
itmap, | 1652 if (filter_texture(this, fContext, devTex, filter, w, h, ctx, &filteredB
itmap, |
1649 &offset)) { | 1653 &offset)) { |
1650 devTex = filteredBitmap.getTexture(); | 1654 devTex = filteredBitmap.getTexture(); |
1651 w = filteredBitmap.width(); | 1655 w = filteredBitmap.width(); |
1652 h = filteredBitmap.height(); | 1656 h = filteredBitmap.height(); |
1653 x += offset.fX; | 1657 x += offset.fX; |
1654 y += offset.fY; | 1658 y += offset.fY; |
1655 } else { | 1659 } else { |
1656 return; | 1660 return; |
1657 } | 1661 } |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 const GrAtlasedLayer* layer = fContext->getLayerCache()->findLayerOr
Create(picture, i); | 1995 const GrAtlasedLayer* layer = fContext->getLayerCache()->findLayerOr
Create(picture, i); |
1992 | 1996 |
1993 SkDebugf("%d (%d), ", i, layer->layerID()); | 1997 SkDebugf("%d (%d), ", i, layer->layerID()); |
1994 } | 1998 } |
1995 } | 1999 } |
1996 SkDebugf("\n"); | 2000 SkDebugf("\n"); |
1997 #endif | 2001 #endif |
1998 | 2002 |
1999 return false; | 2003 return false; |
2000 } | 2004 } |
OLD | NEW |