OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 58 bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParam
s& textureParams, |
59 GrTextureParamsAdjuster::CopyParams* copyPa
rams) const { | 59 GrTextureParamsAdjuster::CopyParams* copyPa
rams) const { |
60 bool doCopy = false; | |
61 const GrCaps& caps = *this->caps(); | 60 const GrCaps& caps = *this->caps(); |
62 if (textureParams.isTiled() && !caps.npotTextureTileSupport() && | 61 if (textureParams.isTiled() && !caps.npotTextureTileSupport() && |
63 (!SkIsPow2(width) || !SkIsPow2(height))) { | 62 (!SkIsPow2(width) || !SkIsPow2(height))) { |
64 doCopy = true; | 63 copyParams->fWidth = GrNextPow2(width); |
65 copyParams->fWidth = GrNextPow2(SkTMax(width, caps.minTextureSize())); | 64 copyParams->fHeight = GrNextPow2(height); |
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()) { | 65 switch (textureParams.filterMode()) { |
76 case GrTextureParams::kNone_FilterMode: | 66 case GrTextureParams::kNone_FilterMode: |
77 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 67 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
78 break; | 68 break; |
79 case GrTextureParams::kBilerp_FilterMode: | 69 case GrTextureParams::kBilerp_FilterMode: |
80 case GrTextureParams::kMipMap_FilterMode: | 70 case GrTextureParams::kMipMap_FilterMode: |
81 // We are only ever scaling up so no reason to ever indicate kMi
pMap. | 71 // We are only ever scaling up so no reason to ever indicate kMi
pMap. |
82 copyParams->fFilter = GrTextureParams::kBilerp_FilterMode; | 72 copyParams->fFilter = GrTextureParams::kBilerp_FilterMode; |
83 break; | 73 break; |
84 } | 74 } |
| 75 return true; |
85 } | 76 } |
86 return doCopy; | 77 return false; |
87 } | 78 } |
88 | 79 |
89 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
{ | 80 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
{ |
90 // By default, GrRenderTargets are GL's normal orientation so that they | 81 // By default, GrRenderTargets are GL's normal orientation so that they |
91 // can be drawn to by the outside world without the client having | 82 // can be drawn to by the outside world without the client having |
92 // to render upside down. | 83 // to render upside down. |
93 if (kDefault_GrSurfaceOrigin == origin) { | 84 if (kDefault_GrSurfaceOrigin == origin) { |
94 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; | 85 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; |
95 } else { | 86 } else { |
96 return origin; | 87 return origin; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); | 343 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
353 } | 344 } |
354 | 345 |
355 GrVertices::Iterator iter; | 346 GrVertices::Iterator iter; |
356 const GrNonInstancedVertices* verts = iter.init(vertices); | 347 const GrNonInstancedVertices* verts = iter.init(vertices); |
357 do { | 348 do { |
358 this->onDraw(args, *verts); | 349 this->onDraw(args, *verts); |
359 fStats.incNumDraws(); | 350 fStats.incNumDraws(); |
360 } while ((verts = iter.next())); | 351 } while ((verts = iter.next())); |
361 } | 352 } |
OLD | NEW |