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

Unified Diff: src/gpu/GrTextureParamsAdjuster.cpp

Issue 1430643002: Remove min texture size support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Delete even more! Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/GrTextureProvider.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextureParamsAdjuster.cpp
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index 9940f9e7d61261ddfe321c587ef7d951dc4071bb..ee3d1351d754b7af4bbadf651d2946054847246d 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -79,28 +79,6 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const CopyParams& copyPar
return copy.detach();
}
-static SkBitmap copy_on_cpu(const SkBitmap& bmp, const CopyParams& copyParams) {
- SkBitmap stretched;
- stretched.allocN32Pixels(copyParams.fWidth, copyParams.fHeight);
- SkCanvas canvas(stretched);
- SkPaint paint;
- switch (copyParams.fFilter) {
- case GrTextureParams::kNone_FilterMode:
- paint.setFilterQuality(kNone_SkFilterQuality);
- break;
- case GrTextureParams::kBilerp_FilterMode:
- paint.setFilterQuality(kLow_SkFilterQuality);
- break;
- case GrTextureParams::kMipMap_FilterMode:
- paint.setFilterQuality(kMedium_SkFilterQuality);
- break;
- }
- SkRect dstRect = SkRect::MakeWH(SkIntToScalar(copyParams.fWidth),
- SkIntToScalar(copyParams.fHeight));
- canvas.drawBitmapRect(bmp, dstRect, &paint);
- return stretched;
-}
-
GrTexture* GrTextureParamsAdjuster::refTextureForParams(GrContext* ctx,
const GrTextureParams& params) {
CopyParams copyParams;
@@ -131,22 +109,9 @@ GrTexture* GrTextureParamsAdjuster::refTextureForParams(GrContext* ctx,
GrTexture* GrTextureParamsAdjuster::generateTextureForParams(GrContext* ctx,
const CopyParams& copyParams) {
- if ((this->width() < ctx->caps()->minTextureSize() ||
- this->height() < ctx->caps()->minTextureSize()) && !this->peekOriginalTexture())
- {
- // we can't trust our ability to use HW to perform the stretch, so we request
- // a raster instead, and perform the stretch on the CPU.
- SkBitmap bitmap;
- if (!this->getROBitmap(&bitmap)) {
- return nullptr;
- }
- SkBitmap stretchedBmp = copy_on_cpu(bitmap, copyParams);
- return GrUploadBitmapToTexture(ctx, stretchedBmp);
- } else {
- SkAutoTUnref<GrTexture> original(this->refOriginalTexture(ctx));
- if (!original) {
- return nullptr;
- }
- return copy_on_gpu(original, copyParams);
+ SkAutoTUnref<GrTexture> original(this->refOriginalTexture(ctx));
+ if (!original) {
+ return nullptr;
}
+ return copy_on_gpu(original, copyParams);
}
« no previous file with comments | « src/gpu/GrTextureParamsAdjuster.h ('k') | src/gpu/GrTextureProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698