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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
58 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
{ | 89 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
{ |
59 // By default, GrRenderTargets are GL's normal orientation so that they | 90 // By default, GrRenderTargets are GL's normal orientation so that they |
60 // can be drawn to by the outside world without the client having | 91 // can be drawn to by the outside world without the client having |
61 // to render upside down. | 92 // to render upside down. |
62 if (kDefault_GrSurfaceOrigin == origin) { | 93 if (kDefault_GrSurfaceOrigin == origin) { |
63 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; | 94 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; |
64 } else { | 95 } else { |
65 return origin; | 96 return origin; |
66 } | 97 } |
67 } | 98 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); | 352 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
322 } | 353 } |
323 | 354 |
324 GrVertices::Iterator iter; | 355 GrVertices::Iterator iter; |
325 const GrNonInstancedVertices* verts = iter.init(vertices); | 356 const GrNonInstancedVertices* verts = iter.init(vertices); |
326 do { | 357 do { |
327 this->onDraw(args, *verts); | 358 this->onDraw(args, *verts); |
328 fStats.incNumDraws(); | 359 fStats.incNumDraws(); |
329 } while ((verts = iter.next())); | 360 } while ((verts = iter.next())); |
330 } | 361 } |
OLD | NEW |