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 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 GrGpu::~GrGpu() { | 32 GrGpu::~GrGpu() { |
33 SkSafeSetNull(fQuadIndexBuffer); | 33 SkSafeSetNull(fQuadIndexBuffer); |
34 } | 34 } |
35 | 35 |
36 void GrGpu::contextAbandoned() {} | 36 void GrGpu::contextAbandoned() {} |
37 | 37 |
38 //////////////////////////////////////////////////////////////////////////////// | 38 //////////////////////////////////////////////////////////////////////////////// |
39 | 39 |
40 namespace { | 40 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
{ |
41 | |
42 GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget) { | |
43 // By default, GrRenderTargets are GL's normal orientation so that they | 41 // By default, GrRenderTargets are GL's normal orientation so that they |
44 // can be drawn to by the outside world without the client having | 42 // can be drawn to by the outside world without the client having |
45 // to render upside down. | 43 // to render upside down. |
46 if (kDefault_GrSurfaceOrigin == origin) { | 44 if (kDefault_GrSurfaceOrigin == origin) { |
47 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; | 45 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; |
48 } else { | 46 } else { |
49 return origin; | 47 return origin; |
50 } | 48 } |
51 } | 49 } |
52 | 50 |
53 } | |
54 | |
55 GrTexture* GrGpu::createTexture(const GrSurfaceDesc& origDesc, bool budgeted, | 51 GrTexture* GrGpu::createTexture(const GrSurfaceDesc& origDesc, bool budgeted, |
56 const void* srcData, size_t rowBytes) { | 52 const void* srcData, size_t rowBytes) { |
57 GrSurfaceDesc desc = origDesc; | 53 GrSurfaceDesc desc = origDesc; |
58 | 54 |
59 if (!this->caps()->isConfigTexturable(desc.fConfig)) { | 55 if (!this->caps()->isConfigTexturable(desc.fConfig)) { |
60 return NULL; | 56 return NULL; |
61 } | 57 } |
62 | 58 |
63 bool isRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); | 59 bool isRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); |
64 if (isRT && !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt
> 0)) { | 60 if (isRT && !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt
> 0)) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 GrDrawTarget::PathIndexType indexType, | 351 GrDrawTarget::PathIndexType indexType, |
356 const float transformValues[], | 352 const float transformValues[], |
357 GrDrawTarget::PathTransformType transformType, | 353 GrDrawTarget::PathTransformType transformType, |
358 int count, | 354 int count, |
359 const GrStencilSettings& stencilSettings) { | 355 const GrStencilSettings& stencilSettings) { |
360 this->handleDirtyContext(); | 356 this->handleDirtyContext(); |
361 pathRange->willDrawPaths(indices, indexType, count); | 357 pathRange->willDrawPaths(indices, indexType, count); |
362 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, | 358 this->onDrawPaths(args, pathRange, indices, indexType, transformValues, |
363 transformType, count, stencilSettings); | 359 transformType, count, stencilSettings); |
364 } | 360 } |
OLD | NEW |