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

Unified Diff: src/gpu/GrGpu.cpp

Issue 1409163002: Rewrite GrTextureMaker to disentangle bitmap case from base class and give GPU object a say in what… (Closed) Base URL: https://skia.googlesource.com/skia.git@move
Patch Set: tidy 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/GrGpu.h ('k') | src/gpu/GrTextureMaker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.cpp
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 96728f3ba80d16950b34225840061b0bc04de32d..48fc740ae0d9697059c7356ff8f3e1bc6e4ceca6 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -55,6 +55,37 @@ void GrGpu::contextAbandoned() {}
////////////////////////////////////////////////////////////////////////////////
+bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParams& textureParams,
+ GrTextureParamsAdjuster::CopyParams* copyParams) const {
+ bool doCopy = false;
+ const GrCaps& caps = *this->caps();
+ if (textureParams.isTiled() && !caps.npotTextureTileSupport() &&
+ (!SkIsPow2(width) || !SkIsPow2(height))) {
+ doCopy = true;
+ copyParams->fWidth = GrNextPow2(SkTMax(width, caps.minTextureSize()));
+ copyParams->fHeight = GrNextPow2(SkTMax(height, caps.minTextureSize()));
+ } else if (width < caps.minTextureSize() || height < caps.minTextureSize()) {
+ // The small texture issues appear to be with tiling. Hence it seems ok to scale
+ // them up using the GPU. If issues persist we may need to CPU-stretch.
+ doCopy = true;
+ copyParams->fWidth = SkTMax(width, caps.minTextureSize());
+ copyParams->fHeight = SkTMax(height, caps.minTextureSize());
+ }
+ if (doCopy) {
+ switch (textureParams.filterMode()) {
+ case GrTextureParams::kNone_FilterMode:
+ copyParams->fFilter = GrTextureParams::kNone_FilterMode;
+ break;
+ case GrTextureParams::kBilerp_FilterMode:
+ case GrTextureParams::kMipMap_FilterMode:
+ // We are only ever scaling up so no reason to ever indicate kMipMap.
+ copyParams->fFilter = GrTextureParams::kBilerp_FilterMode;
+ break;
+ }
+ }
+ return doCopy;
+}
+
static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget) {
// By default, GrRenderTargets are GL's normal orientation so that they
// can be drawn to by the outside world without the client having
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrTextureMaker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698