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

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

Issue 1409923003: Revert of 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: 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrTextureMaker.h » ('j') | 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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 , fResetBits(kAll_GrBackendState) 48 , fResetBits(kAll_GrBackendState)
49 , fContext(context) { 49 , fContext(context) {
50 } 50 }
51 51
52 GrGpu::~GrGpu() {} 52 GrGpu::~GrGpu() {}
53 53
54 void GrGpu::contextAbandoned() {} 54 void GrGpu::contextAbandoned() {}
55 55
56 //////////////////////////////////////////////////////////////////////////////// 56 ////////////////////////////////////////////////////////////////////////////////
57 57
58 bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParam s& textureParams,
59 GrTextureParamsAdjuster::CopyParams* copyPa rams) const {
60 bool doCopy = false;
61 const GrCaps& caps = *this->caps();
62 if (textureParams.isTiled() && !caps.npotTextureTileSupport() &&
63 (!SkIsPow2(width) || !SkIsPow2(height))) {
64 doCopy = true;
65 copyParams->fWidth = GrNextPow2(SkTMax(width, caps.minTextureSize()));
66 copyParams->fHeight = GrNextPow2(SkTMax(height, caps.minTextureSize()));
67 } else if (width < caps.minTextureSize() || height < caps.minTextureSize()) {
68 // The small texture issues appear to be with tiling. Hence it seems ok to scale
69 // them up using the GPU. If issues persist we may need to CPU-stretch.
70 doCopy = true;
71 copyParams->fWidth = SkTMax(width, caps.minTextureSize());
72 copyParams->fHeight = SkTMax(height, caps.minTextureSize());
73 }
74 if (doCopy) {
75 switch (textureParams.filterMode()) {
76 case GrTextureParams::kNone_FilterMode:
77 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
78 break;
79 case GrTextureParams::kBilerp_FilterMode:
80 case GrTextureParams::kMipMap_FilterMode:
81 // We are only ever scaling up so no reason to ever indicate kMi pMap.
82 copyParams->fFilter = GrTextureParams::kBilerp_FilterMode;
83 break;
84 }
85 }
86 return doCopy;
87 }
88
89 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget) { 58 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget) {
90 // By default, GrRenderTargets are GL's normal orientation so that they 59 // By default, GrRenderTargets are GL's normal orientation so that they
91 // can be drawn to by the outside world without the client having 60 // can be drawn to by the outside world without the client having
92 // to render upside down. 61 // to render upside down.
93 if (kDefault_GrSurfaceOrigin == origin) { 62 if (kDefault_GrSurfaceOrigin == origin) {
94 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr igin; 63 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr igin;
95 } else { 64 } else {
96 return origin; 65 return origin;
97 } 66 }
98 } 67 }
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); 321 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType);
353 } 322 }
354 323
355 GrVertices::Iterator iter; 324 GrVertices::Iterator iter;
356 const GrNonInstancedVertices* verts = iter.init(vertices); 325 const GrNonInstancedVertices* verts = iter.init(vertices);
357 do { 326 do {
358 this->onDraw(args, *verts); 327 this->onDraw(args, *verts);
359 fStats.incNumDraws(); 328 fStats.incNumDraws();
360 } while ((verts = iter.next())); 329 } while ((verts = iter.next()));
361 } 330 }
OLDNEW
« 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