Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 665863003: Remove unused parameters from filter_texture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); 1328 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType());
1329 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor() ) : 1329 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor() ) :
1330 SkColor2GrColor(paint.getColor()); 1330 SkColor2GrColor(paint.getColor());
1331 SkPaint2GrPaintNoShader(this->context(), paint, paintColor, false, &grPaint) ; 1331 SkPaint2GrPaintNoShader(this->context(), paint, paintColor, false, &grPaint) ;
1332 1332
1333 fContext->drawRectToRect(grPaint, dstRect, paintRect); 1333 fContext->drawRectToRect(grPaint, dstRect, paintRect);
1334 } 1334 }
1335 1335
1336 static bool filter_texture(SkBaseDevice* device, GrContext* context, 1336 static bool filter_texture(SkBaseDevice* device, GrContext* context,
1337 GrTexture* texture, const SkImageFilter* filter, 1337 GrTexture* texture, const SkImageFilter* filter,
1338 int w, int h, const SkImageFilter::Context& ctx, 1338 const SkImageFilter::Context& ctx,
1339 SkBitmap* result, SkIPoint* offset) { 1339 SkBitmap* result, SkIPoint* offset) {
1340 SkASSERT(filter); 1340 SkASSERT(filter);
1341 SkDeviceImageFilterProxy proxy(device); 1341 SkDeviceImageFilterProxy proxy(device);
1342 1342
1343 if (filter->canFilterImageGPU()) { 1343 if (filter->canFilterImageGPU()) {
1344 // Save the render target and set it to NULL, so we don't accidentally d raw to it in the 1344 // Save the render target and set it to NULL, so we don't accidentally d raw to it in the
1345 // filter. Also set the clip wide open and the matrix to identity. 1345 // filter. Also set the clip wide open and the matrix to identity.
1346 GrContext::AutoWideOpenIdentityDraw awo(context, NULL); 1346 GrContext::AutoWideOpenIdentityDraw awo(context, NULL);
1347 return filter->filterImageGPU(&proxy, wrap_texture(texture), ctx, result , offset); 1347 return filter->filterImageGPU(&proxy, wrap_texture(texture), ctx, result , offset);
1348 } else { 1348 } else {
(...skipping 24 matching lines...) Expand all
1373 1373
1374 if (filter) { 1374 if (filter) {
1375 SkIPoint offset = SkIPoint::Make(0, 0); 1375 SkIPoint offset = SkIPoint::Make(0, 0);
1376 SkMatrix matrix(*draw.fMatrix); 1376 SkMatrix matrix(*draw.fMatrix);
1377 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top)); 1377 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
1378 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height()); 1378 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
1379 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache()); 1379 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
1380 // This cache is transient, and is freed (along with all its contained 1380 // This cache is transient, and is freed (along with all its contained
1381 // textures) when it goes out of scope. 1381 // textures) when it goes out of scope.
1382 SkImageFilter::Context ctx(matrix, clipBounds, cache); 1382 SkImageFilter::Context ctx(matrix, clipBounds, cache);
1383 if (filter_texture(this, fContext, texture, filter, w, h, ctx, &filtered Bitmap, 1383 if (filter_texture(this, fContext, texture, filter, ctx, &filteredBitmap ,
1384 &offset)) { 1384 &offset)) {
1385 texture = (GrTexture*) filteredBitmap.getTexture(); 1385 texture = (GrTexture*) filteredBitmap.getTexture();
1386 w = filteredBitmap.width(); 1386 w = filteredBitmap.width();
1387 h = filteredBitmap.height(); 1387 h = filteredBitmap.height();
1388 left += offset.x(); 1388 left += offset.x();
1389 top += offset.y(); 1389 top += offset.y();
1390 } else { 1390 } else {
1391 return; 1391 return;
1392 } 1392 }
1393 } 1393 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 1484
1485 if (filter) { 1485 if (filter) {
1486 SkIPoint offset = SkIPoint::Make(0, 0); 1486 SkIPoint offset = SkIPoint::Make(0, 0);
1487 SkMatrix matrix(*draw.fMatrix); 1487 SkMatrix matrix(*draw.fMatrix);
1488 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 1488 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
1489 SkIRect clipBounds = SkIRect::MakeWH(devTex->width(), devTex->height()); 1489 SkIRect clipBounds = SkIRect::MakeWH(devTex->width(), devTex->height());
1490 // This cache is transient, and is freed (along with all its contained 1490 // This cache is transient, and is freed (along with all its contained
1491 // textures) when it goes out of scope. 1491 // textures) when it goes out of scope.
1492 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache()); 1492 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
1493 SkImageFilter::Context ctx(matrix, clipBounds, cache); 1493 SkImageFilter::Context ctx(matrix, clipBounds, cache);
1494 if (filter_texture(this, fContext, devTex, filter, w, h, ctx, &filteredB itmap, 1494 if (filter_texture(this, fContext, devTex, filter, ctx, &filteredBitmap,
1495 &offset)) { 1495 &offset)) {
1496 devTex = filteredBitmap.getTexture(); 1496 devTex = filteredBitmap.getTexture();
1497 w = filteredBitmap.width(); 1497 w = filteredBitmap.width();
1498 h = filteredBitmap.height(); 1498 h = filteredBitmap.height();
1499 x += offset.fX; 1499 x += offset.fX;
1500 y += offset.fY; 1500 y += offset.fY;
1501 } else { 1501 } else {
1502 return; 1502 return;
1503 } 1503 }
1504 } 1504 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 SkAutoLockPixels alp(src, !src.getTexture()); 1537 SkAutoLockPixels alp(src, !src.getTexture());
1538 if (!src.getTexture() && !src.readyToDraw()) { 1538 if (!src.getTexture() && !src.readyToDraw()) {
1539 return false; 1539 return false;
1540 } 1540 }
1541 1541
1542 GrTexture* texture; 1542 GrTexture* texture;
1543 // We assume here that the filter will not attempt to tile the src. Otherwis e, this cache lookup 1543 // We assume here that the filter will not attempt to tile the src. Otherwis e, this cache lookup
1544 // must be pushed upstack. 1544 // must be pushed upstack.
1545 AutoBitmapTexture abt(fContext, src, NULL, &texture); 1545 AutoBitmapTexture abt(fContext, src, NULL, &texture);
1546 1546
1547 return filter_texture(this, fContext, texture, filter, src.width(), src.heig ht(), ctx, 1547 return filter_texture(this, fContext, texture, filter, ctx, result, offset);
1548 result, offset);
1549 } 1548 }
1550 1549
1551 /////////////////////////////////////////////////////////////////////////////// 1550 ///////////////////////////////////////////////////////////////////////////////
1552 1551
1553 // must be in SkCanvas::VertexMode order 1552 // must be in SkCanvas::VertexMode order
1554 static const GrPrimitiveType gVertexMode2PrimitiveType[] = { 1553 static const GrPrimitiveType gVertexMode2PrimitiveType[] = {
1555 kTriangles_GrPrimitiveType, 1554 kTriangles_GrPrimitiveType,
1556 kTriangleStrip_GrPrimitiveType, 1555 kTriangleStrip_GrPrimitiveType,
1557 kTriangleFan_GrPrimitiveType, 1556 kTriangleFan_GrPrimitiveType,
1558 }; 1557 };
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 GrLayerHoister::UnlockLayers(fContext, atlased, nonAtlased, recycled); 1824 GrLayerHoister::UnlockLayers(fContext, atlased, nonAtlased, recycled);
1826 1825
1827 return true; 1826 return true;
1828 } 1827 }
1829 1828
1830 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1829 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1831 // We always return a transient cache, so it is freed after each 1830 // We always return a transient cache, so it is freed after each
1832 // filter traversal. 1831 // filter traversal.
1833 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1832 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1834 } 1833 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698